Skip to main content

Guidance for External Connectivity to Amazon VPC Lattice

Overview

Important: This Guidance requires the use of AWS CodeCommit, which is no longer available to new customers. Existing customers of AWS CodeCommit can continue using and deploying this Guidance as normal.

This Guidance demonstrates how to configure a proxy in a virtual private cloud (VPC) to connect external services to your Amazon VPC Lattice service network, enabling public, hybrid, or cross-Region access. While VPC Lattice simplifies service-to-service consumption within an AWS Region, if your applications reside outside that Region, you'll need to create and manage a proxy solution. By following this Guidance to build an ingress VPC and configure appropriate DNS resolution, you can easily establish connectivity to your external resources from your VPC Lattice service network.

How it works

Overview

This architecture diagram shows how to configure a proxy in a virtual private cloud (VPC) to connect external services to Amazon VPC Lattice. There are three ways to use Amazon VPC Lattice for public, hybrid, or cross-Region access. Each are outlined further are in the corresponding tabs.

Architecture diagram showing AWS external connectivity using VPC Lattice, featuring AWS CodePipeline, CodeCommit, CodeBuild, CodeDeploy, Amazon ECR, NGINX, Amazon ECS Fargate clusters, network load balancers, internet and VPN gateways, and a multi-AZ VPC with public and private subnets.

Public access

This architecture diagram shows how placing a proxy solution in an associated VPC enables external consumption of VPC Lattice services by adjusting the DNS resolution.

Architecture diagram showing how AWS VPC Lattice enables external connectivity and public access, illustrating the networking flow between consumer applications on the internet and backend services such as AWS Lambda via VPC Lattice, Network Load Balancer, AWS Fargate proxy fleet, resolvers, and hosted zones.

Hybrid access

This architecture diagram shows how placing a proxy solution in an associated VPC enables on-premises applications to have external consumption of VPC Lattice services by adjusting the hybrid DNS resolution.

Architecture diagram illustrating AWS VPC Lattice hybrid access and external connectivity. Shows how on-premises data centers, DNS servers, and consumer applications connect to AWS services such as VPC Lattice, Lambda, Route 53, and network load balancers through a combination of gateways, VPCs, resolvers, and service associations. Includes record setup examples for DNS configurations.

Cross-Region access

This architecture diagram shows how placing a proxy solution in an associated VPC enables cross-Region consumption of VPC Lattice services by adjusting the hybrid DNS resolution.

Architecture diagram showing AWS VPC Lattice cross-region external connectivity, including a consumer VPC in Region 1, a service network and provider in Region 2, network load balancer, proxy fleet, VPC Lattice service network, and DNS records for service discovery.

Well-Architected Pillars

The architecture diagram above is an example of a Solution created with Well-Architected best practices in mind. To be fully Well-Architected, you should follow as many Well-Architected best practices as possible.

CodePipeline enables you to use a pipeline to make controlled and auditable changes through an artifact repository for the NGINX proxy solution, helping you avoid undesired updates. In addition, CloudFormation uses infrastructure as code to deploy all resources, giving you visibility and control over the created resources.

Read the Operational Excellence whitepaper

VPC Lattice handles authentication and authorization by using optional auth policies, both in the VPC Lattice service network and services. AWS Identity and Access Management (IAM), which uses the Zero Trust on AWS security model, establishes secure authentication and authorization mechanisms for service-to-service communication. IAM security credentials generate AWS Signature Version 4 signatures, which are passed to VPC Lattice. Common network security measures for the VPC and application add a second layer of security control. For example, you can use security groups and network access control lists, and the NGINX configuration enables you to define an allowlist of the source IPs that can connect to the proxy targets.

Read the Security whitepaper

This Guidance deploys resources in three AZs, providing high availability for your proxy solution, made using a Network Load Balancer and an Amazon ECSon Fargate fleet. Additionally, CodePipeline uses managed AWS services—including CodeCommit, CodeBuild, and CloudFormation—that are built to be highly available within a Region by default.

Note: This Guidance has been built on the assumption that it will automatically scale and contract using average CPU metrics for the Amazon ECS service as the dimension. Load testing revealed that the Guidance is CPU-bound as the load increases, based on the specifications of the chosen task sizes. You can adjust this Guidance to use a metric that best suits your application’s profile and load.

Read the Reliability whitepaper

This Guidance uses a combination of AWS native services and customizable options. It uses a Network Load Balancer as the entry point because it provides high throughput, flexibility in protocol, and feature support when connecting to VPC Lattice. An Amazon ECS on Fargate proxy fleet provides flexibility in resolving the domain name generated by VPC Lattice to the link-local addresses (which might vary). The fleet uses Fargate to gain the scalability of serverless technologies and to simplify container management.

Read the Performance Efficiency whitepaper

This Guidance automatically scales the Amazon ECS on Fargate tasks as required, depending on CPU utilization. This automatic scalability of Amazon ECS means that the proxy solution only uses the required compute capacity, so you do not have to pay for unnecessary compute.

Read the Cost Optimization whitepaper

Amazon ECS on Fargate handles scaling automatically so that your proxy solution has an optimal compute footprint based on CPU load. Additionally, the tasks use a lightweight version of NGINX to minimize the computational load when sending requests to VPC Lattice. By using configured and tested workload elasticity, this Guidance helps you efficiently match your cloud resource utilization to demand and avoid overprovisioned capacity, ultimately lowering your carbon footprint.

Read the Sustainability whitepaper

Deploy with confidence

Ready to deploy? Review the sample code on GitHub for detailed deployment instructions to deploy as-is or customize to fit your needs. 

Go to sample code

Disclaimer

The sample code; software libraries; command line tools; proofs of concept; templates; or other related technology (including any of the foregoing that are provided by our personnel) is provided to you as AWS Content under the AWS Customer Agreement, or the relevant written agreement between you and AWS (whichever applies). You should not use this AWS Content in your production accounts, or on production or other critical data. You are responsible for testing, securing, and optimizing the AWS Content, such as sample code, as appropriate for production grade use based on your specific quality control practices and standards. Deploying AWS Content may incur AWS charges for creating or using AWS chargeable resources, such as running Amazon EC2 instances or using Amazon S3 storage.