Introduction
Modern cloud applications are no longer built as a single monolithic application. Instead, they consist of multiple microservices deployed across different VPCs, AWS accounts, and environments such as Development, Testing, and Production.
Traditionally, organizations relied on VPC Peering or AWS Transit Gateway to establish communication between these VPCs. While these services provide network connectivity, they also introduce additional complexity around route tables, attachments, and security management.
AWS introduced Amazon VPC Lattice to simplify service-to-service communication by focusing on application networking rather than network connectivity.
In this blog, we'll build a simple VPC Lattice environment from scratch and understand how applications can communicate securely across isolated VPCs without configuring Transit Gateway or VPC Peering.
What We'll Build
Our architecture consists of two isolated VPCs.
Prerequisites
Before starting, ensure you have:
- IAM permissions to create VPCs and EC2
- Basic understanding of EC2 and VPC
- Region: us-east-1 (used in this walkthrough)
Step 1 – Create Two VPCs
We first create two completely isolated VPCs
VPC | CIDR | Purpose |
|---|
Provider-VPC | 10.0.0.0/16 | Hosts the application |
Consumer-VPC | 10.1.0.0/16 | Accesses the application |
Each VPC contains one public subnet.
Provider Subnet
Consumer Subnet
At this stage, there is no communication between these VPCs.
Step 2 – Configure Internet Connectivity
To access EC2 instances, we configured:
- Public Subnet Association
Each subnet now has internet connectivity.
Step 3 – Launch EC2 Instances
Next, we launched two EC2 instances.
Provider EC2
Purpose:
Hosts our web application.
Configuration:
Consumer EC2
Purpose:
Acts as the client machine.
Configuration:
Step 4 – Install Nginx
On the Provider EC2, install Nginx.
sudo dnf update -y
sudo dnf install nginx -y
sudo systemctl enable nginx
sudo systemctl start nginx
Verify:
sudo systemctl status nginx
You should see:
Step 5 – Deploy a Sample Web Page
Replace the default index page.
echo '<h1>Hello from Provider VPC using VPC Lattice!</h1>' \
| sudo tee /usr/share/nginx/html/index.html
Verify:
Output
<h1>Hello from Provider VPC using VPC Lattice!</h1>
Step 6 – Verify Traditional Access
Allow HTTP (Port 80) in the Security Group.
Open the browser.
Result
Hello from Provider VPC using VPC Lattice!
This represents the traditional architecture where applications are accessed directly using a Public IP.
Internet
↓
Public IP
↓
EC2
↓
Application
While simple, this exposes the application publicly and tightly couples clients to server IP addresses.
Step 7 – Create a VPC Lattice Target Group
Next, create a Target Group.
Purpose:
The Target Group tells VPC Lattice where the application is running.
Configuration
Setting | Value |
|---|
Target Type | Instance |
Protocol | HTTP |
Port | 80 |
Register:
Important: Register the EC2 instance as a target. If no targets are registered, VPC Lattice returns:
This was an issue we encountered during our implementation.
Step 8 – Create a VPC Lattice Service
Create a new service.
Configuration
Property | Value |
|---|
Authentication | None |
Listener | HTTP |
Port | 80 |
Associate the Target Group.
AWS automatically generates a DNS name similar to:
provider-web-service-xxxx.vpc-lattice-svcs.us-east-1.on.aws
Applications will use this DNS instead of the EC2 Public IP.
Step 9 – Create a Service Network
Create a Service Network.
Associate:
Then associate both:
This allows both VPCs to participate in the same application network without configuring Transit Gateway or VPC Peering.
Step 10 – Test Connectivity
SSH into the Consumer EC2.
Instead of using the Public IP, run:
curl http://<VPC-Lattice-Service-DNS>
Output
<h1>Hello from Provider VPC using VPC Lattice!</h1>
At this point, the Consumer VPC successfully communicates with the Provider application through VPC Lattice.
AWS Account
us-east-1 Region
│
┌────────────────┴────────────────┐
│ │
▼ ▼
Provider-VPC Consumer-VPC
(10.0.0.0/16) (10.1.0.0/16)
│ │
▼ ▼
Provider-WebServer Consumer EC2
(Nginx) │
│ │
▼ │
Target Group │
│ │
▼ │
Provider-Web-Service │
│ │
└──────────────┬──────────────────┘
▼
demo-service-network
│
AWS VPC Lattice
Architectural Diagram
Traditional Networking vs VPC Lattice
Traditional
The client directly knows the server IP.
VPC Lattice
Consumer EC2
↓
VPC Lattice Service
↓
Target Group
↓
Provider EC2
The client knows only the service, not the server.
This abstraction simplifies application connectivity and enables centralized routing and security.
Challenges We Faced
During implementation, we encountered a few common issues:
Missing HTTP Rule
Initially, the application wasn't accessible because the Security Group allowed only SSH. Adding an HTTP (80) inbound rule resolved the issue.
Bash "event not found"
While updating the HTML page, the ! character triggered Bash history expansion. Using single quotes fixed the problem.
503 Service Unavailable
The VPC Lattice service returned a 503 error because the Target Group was created without registering the EC2 instance. Registering the target and waiting for a healthy status resolved the issue.
These troubleshooting steps are useful for anyone implementing VPC Lattice for the first time.
Key Takeaways
- VPC Lattice focuses on application connectivity, not network connectivity.
- Applications communicate using a service DNS rather than server IP addresses.
- No Transit Gateway or VPC Peering was required.
- Service Networks simplify connectivity across isolated VPCs.
- Target Groups provide health checks and backend management.
- Consumers remain unaware of the underlying infrastructure.
What's Next?
In Part 2, we'll make this architecture more secure by exploring VPC Lattice's Zero Trust capabilities.
We'll cover:
- Security Groups on VPC Associations
- Access control experiments
- Comparison with AWS Transit Gateway
Conclusion
AWS VPC Lattice changes the way applications communicate in AWS by shifting the focus from network-to-network connectivity to service-to-service connectivity. Instead of exposing applications through Public IPs or building complex network topologies, VPC Lattice provides a managed application networking layer with service discovery, health checks, and centralized access control.
In this hands-on guide, we built a working VPC Lattice environment from scratch, connected two isolated VPCs, and accessed an application using a VPC Lattice service DNS—all without Transit Gateway or VPC Peering. This forms a strong foundation for implementing modern, secure, and scalable application networking architectures on AWS.
Loading article