Explain AWS VPC Peering
AWS VPC Peering is a networking connection between two VPCs that enables private communication using AWS internal networking.
It allows resources in different VPCs to communicate securely as if they were in the same network.
Why VPC Peering is Needed
Large organizations often use multiple VPCs for:
- Environment separation
- Microservices architecture
- Security isolation
- Multi-team deployments
- Multi-account architectures
These VPCs may still need secure communication.
Without VPC Peering
VPC A
|
Public Internet
|
VPC B
This approach increases latency, security risks, and operational complexity.
With VPC Peering
VPC A
|
Private AWS Network
|
VPC B
High-Level VPC Peering Architecture
------------------------------------------------
| AWS Region |
| |
| VPC A <---- Peering ----> VPC B |
| |
------------------------------------------------
Main Features of VPC Peering
| Feature | Description |
|---|---|
| Private Connectivity | Traffic stays inside AWS network |
| Low Latency | Direct communication |
| No Internet Required | Secure internal routing |
| Cross-Account Support | Works across AWS accounts |
| Cross-Region Support | Can connect VPCs across regions |
How VPC Peering Works
AWS creates a private networking connection between two VPCs.
Traffic Flow
EC2 Instance in VPC A
|
Route Table
|
VPC Peering Connection
|
Route Table
|
EC2 Instance in VPC B
Steps to Configure VPC Peering
- Create Peering Connection
- Accept Peering Request
- Update Route Tables
- Configure Security Groups
Step 1: Create Peering Connection
One VPC sends a peering request to another VPC.
Architecture
VPC A
|
Peering Request
|
VPC B
Step 2: Accept Peering Request
The target VPC owner accepts the request.
Step 3: Update Route Tables
Both VPCs must update Route Tables to direct traffic through the peering connection.
Example Route Table
| Destination | Target |
|---|---|
| 10.1.0.0/16 | Peering Connection |
Step 4: Configure Security Groups
Security Groups must allow traffic between the peered VPCs.
Complete VPC Peering Architecture
---------------------------------------------------------
| AWS |
| |
| VPC A VPC B |
| 10.0.0.0/16 10.1.0.0/16 |
| |
| EC2-A ---- Peering Connection ---- EC2-B |
| |
---------------------------------------------------------
Types of VPC Peering
| Type | Description |
|---|---|
| Intra-Region Peering | Same AWS Region |
| Inter-Region Peering | Different AWS Regions |
| Cross-Account Peering | Different AWS accounts |
1. Intra-Region Peering
VPC A (Mumbai Region)
|
Peering
|
VPC B (Mumbai Region)
2. Inter-Region Peering
VPC A (Mumbai)
|
Inter-Region Peering
|
VPC B (Singapore)
3. Cross-Account Peering
AWS Account A
|
VPC Peering
|
AWS Account B
Real-World Use Cases
- Microservices communication
- Shared database access
- Centralized logging systems
- Shared security services
- Development and production isolation
Microservices Architecture Example
Payment VPC
|
Peering
|
Order Management VPC
|
Peering
|
Notification VPC
Multi-Environment Architecture
Development VPC
|
Peering
|
Shared Services VPC
|
Peering
|
Production VPC
Advantages of VPC Peering
- Secure communication
- Private network traffic
- Low latency
- Simple architecture
- No VPN required
Limitations of VPC Peering
- No transitive routing
- Complex management at scale
- CIDR overlap not allowed
What is No Transitive Routing?
VPC Peering does not support indirect communication.
Example
VPC A <--> VPC B <--> VPC C
VPC A CANNOT directly access VPC C
through VPC B.
Overlapping CIDR Restriction
Peered VPCs cannot have overlapping IP ranges.
Invalid Example
VPC A → 10.0.0.0/16
VPC B → 10.0.0.0/16
Valid Example
VPC A → 10.0.0.0/16
VPC B → 10.1.0.0/16
VPC Peering vs Transit Gateway
| Feature | VPC Peering | Transit Gateway |
|---|---|---|
| Scale | Small to Medium | Large Enterprise |
| Transitive Routing | No | Yes |
| Management Complexity | Higher at scale | Centralized |
Security Best Practices
- Use least privilege security groups
- Enable VPC Flow Logs
- Avoid unnecessary peering connections
- Monitor network traffic
- Use separate route tables
Monitoring VPC Peering
- CloudWatch
- VPC Flow Logs
- CloudTrail
- AWS Config
Production Banking Architecture Example
Customer Services VPC
|
Peering
|
Authentication VPC
|
Peering
|
Fraud Detection VPC
Common VPC Peering Mistakes
- Overlapping CIDR ranges
- Missing route table updates
- Incorrect security group rules
- Large-scale mesh peering architectures
Enterprise Architecture Pattern
Shared Services VPC
|
--------------------------------
| | | |
Dev VPC QA VPC Prod VPC DR VPC
Interview Answer
AWS VPC Peering is a private networking connection between two VPCs that allows resources to communicate securely using AWS internal infrastructure.
It supports:
- Intra-region communication
- Inter-region communication
- Cross-account communication
To configure VPC Peering:
- Create peering connection
- Accept request
- Update route tables
- Configure security groups
VPC Peering provides secure, low-latency communication without using the public internet.
Quick Summary Table
| Feature | VPC Peering |
|---|---|
| Purpose | Private VPC communication |
| Internet Required | No |
| Cross-Region Support | Yes |
| Cross-Account Support | Yes |
| Transitive Routing | No |
Useful Internal Links
- AWS Interview Questions
- Cloud Computing Interview Questions
- DevOps Interview Questions
- Docker Interview Questions
- Kubernetes Interview Questions
Final Conclusion
AWS VPC Peering is an important networking feature for connecting isolated VPCs securely.
It enables private, low-latency communication between applications, microservices, and environments without exposing traffic to the internet.
Understanding VPC Peering is essential for designing enterprise-grade, multi-network AWS architectures.