This lesson combines 3 topics: VPC Advanced Concepts, Transit Gateway Deep Dive, AWS Direct Connect.
Learning Objectives
- Understand VPC Endpoints in depth
- Master VPC Peering and its limitations
- Know how to design multi-VPC architectures
- Understand the architecture and components of Transit Gateway
- Master routing concepts and route tables
- Know how to implement network segmentation
- Understand the architecture and components of Direct Connect
- Master Virtual Interfaces (VIFs)
- Know how to design for high availability
Part 1: VPC Advanced Concepts
1. VPC Endpoints
Types of VPC Endpoints
Gateway Endpoint Architecture
Interface Endpoint Architecture
Endpoint Policies
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowSpecificBucket",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::my-secure-bucket",
"arn:aws:s3:::my-secure-bucket/*"
]
}
]
}
DynamoDB: Gateway vs Interface Endpoint
DynamoDB supports both endpoint types. Knowing which one fits a SAP-C02 scenario matters.
| Criteria | DynamoDB Gateway Endpoint | DynamoDB Interface Endpoint (PrivateLink) |
|---|---|---|
| Pricing | Free | $0.01/hour/AZ + data processing |
| Access from within the VPC | ✓ | ✓ |
| Access from on-premises (DX/VPN) | ✗ Not supported | ✓ Yes |
| Cross-region access | ✗ | ✓ (via VPC peering / TGW) |
| Setup | Add a route to the route table | Create an ENI in the subnet |
| DNS resolution | Public DNS → private route | Private DNS name |
| Default use case | All traffic within the VPC | Hybrid: on-prem needs to access DynamoDB |
Exam keyword:
- "Most cost-effective access to DynamoDB from VPC" → Gateway Endpoint (free)
- "Access DynamoDB from on-premises through Direct Connect/VPN" → Interface Endpoint (PrivateLink)
- "Hybrid architecture, on-prem app calls DynamoDB privately" → Interface Endpoint
Note: S3 also has both endpoint types with a similar pattern (S3 Interface Endpoint GA 2021 for hybrid use cases).
2. VPC Peering
How it works
Key Characteristics
- Non-transitive: Traffic cannot transit through peered VPC
- Cross-region: Supported with inter-region peering
- Cross-account: Supported with accepter approval
- No overlapping CIDR: VPCs cannot have overlapping IP ranges
Transitive Peering Problem
VPC Peering Limitations
| Limitation | Detail |
|---|---|
| Max peers per VPC | 125 |
| Bandwidth | No aggregate limit |
| Transitive routing | Not supported |
| Overlapping CIDR | Not supported |
| DNS resolution | Needs enablement |
3. Multi-VPC Architectures
Pattern 1: Hub-and-Spoke (Full Mesh Peering)
Pattern 2: Transit Gateway (Recommended)
4. Private DNS with VPC
Route 53 Private Hosted Zone
Route 53 Resolver
5. VPC Design Best Practices
CIDR Planning
Subnet Design
Part 2: Transit Gateway Deep Dive
1. Transit Gateway Overview
Definition
AWS Transit Gateway is a regional network transit hub that lets you connect:
- VPCs (same or different accounts)
- VPN connections
- AWS Direct Connect gateways
- Transit Gateway peering (cross-region)
Architecture
2. Attachments
Types of Attachments
VPC Attachment Details
3. Route Tables
Default vs Custom Route Tables
Route Types
| Type | Description |
|---|---|
| Static | Manually added, highest priority |
| Propagated | Automatically learned from attachments |
| Blackhole | Drop traffic matching this route |
4. Network Segmentation
Isolation Pattern
Shared Services Pattern
5. Hybrid Connectivity
VPN with Transit Gateway
ECMP for Higher VPN Bandwidth
6. Transit Gateway Peering
Cross-Region Peering
7. Costs
Pricing Model
| Component | Cost (varies by region) |
|---|---|
| Attachment | ~$0.05/hour |
| Data processed | ~$0.02/GB |
| VPN Attachment | Standard VPN pricing |
| Peering data | Standard data transfer |
Cost Optimization
1. Consolidate VPCs where possible
- Fewer attachments = lower cost
2. Use VPC Peering for high-bandwidth pairs
- No per-GB charge
3. Monitor data transfer
- CloudWatch metrics for TGW
Part 3: AWS Direct Connect
1. Direct Connect Overview
Definition
AWS Direct Connect is a dedicated network connection from on-premises to AWS that provides:
- Lower latency than the internet
- Consistent network performance
- Reduced bandwidth costs (for high volume)
- Private connectivity
Connection Types
2. Architecture
Physical Architecture
Logical Architecture
3. Virtual Interfaces (VIFs)
Private VIF
Public VIF
Transit VIF
4. Direct Connect Gateway
Purpose
Connect Direct Connect to multiple VPCs across regions
5. High Availability Design
Single Location (Low Resilience)
Dual Connections (Medium Resilience)
Dual Locations (High Resilience) - Recommended
Maximum Resilience
6. Backup with VPN
Direct Connect + VPN Backup
7. Link Aggregation Group (LAG)
Purpose
Bundle multiple physical connections for:
- Higher bandwidth
- Active-Active load balancing
8. Direct Connect SiteLink
Definition
SiteLink is a feature enabled on a Virtual Interface attached to a Direct Connect Gateway. It lets traffic flow directly between Direct Connect locations (on-premises site ↔ on-premises site) over the AWS global backbone, WITHOUT detouring through any Region or VPC.
How it works
- Enable SiteLink on each VIF (private or transit VIF) attached to the DX Gateway
- VIFs on the same DX Gateway with SiteLink enabled can route to each other: BGP routes learned from one site are advertised to the other site through the DX Gateway
- Traffic takes the shortest path on the AWS backbone between the 2 DX locations, with no hairpin through a Region
- You can create multiple DX Gateways to separate routing between groups of sites (segmentation)
Use cases
- Replace a private WAN/MPLS between data centers at different DX locations, even across countries/continents, using the AWS global backbone instead of leasing dedicated circuits
- Site-to-site connectivity when the DCs already have Direct Connect: no need to build extra MPLS/leased lines
- Combined: the same VIF can both access VPCs (via DX Gateway) and talk site-to-site (SiteLink)
Pricing
- Billed separately: per hour for each SiteLink-enabled VIF + data transfer between DX locations
- Exam trade-off: SiteLink costs more than regular DX traffic, but is much cheaper and faster than building/maintaining a global MPLS WAN yourself
Exam Keywords
| Keyword in the question | Answer |
|---|---|
| "Connect data centers to each other using Direct Connect" | SiteLink |
| "Avoid MPLS/private WAN between sites", "retire MPLS circuits" | SiteLink |
| "Site-to-site traffic without traversing a Region/VPC" | SiteLink |
| "Data centers in multiple countries need to connect, DX already in place" | SiteLink on DX Gateway |
Review Questions
-
How do Gateway Endpoints and Interface Endpoints differ?
Show answer
Gateway Endpoint: S3 and DynamoDB only, free, added to the route table, no ENI created. Interface Endpoint: most AWS services, paid (~$0.01/hour/AZ + $0.01/GB), creates an ENI with a private IP in the subnet, supports Private DNS. Interface Endpoints use PrivateLink and can be used for custom services (via NLB). A Gateway Endpoint is simple and free for S3/DynamoDB; an Interface Endpoint is for other services that need private access.
-
Does VPC Peering support transitive routing?
Show answer
No. VPC Peering has no transitive routing. If A-B are peered and B-C are peered, A cannot reach C through B. You must create a direct A-C peering. With many VPCs (N VPCs), you need N×(N-1)/2 peering connections, which does not scale. Transit Gateway solves this: hub-and-spoke, transitive routing, N connections instead of N² connections.
-
When should you use VPC Peering vs Transit Gateway?
Show answer
VPC Peering when: 2-4 VPCs need to connect, no transitive routing is needed, you want to reduce cost (peering is free, TGW charges attachment + processing), and you do not need centralized routing control. Transit Gateway when: more than 5 VPCs, transitive routing is needed, you need a centralized network hub (VPN + DX + VPCs from one point), you need cross-region (TGW peering), or you need network segmentation with separate route tables.
-
What is a Route 53 Resolver Inbound endpoint used for?
Show answer
An Inbound Endpoint lets on-premises DNS servers forward queries to Route 53 Resolver to resolve AWS private hosted zones and VPC internal hostnames. On-premises DNS forwards requests to the Inbound Endpoint IPs (in the VPC) over Direct Connect or VPN. Conversely, an Outbound Endpoint lets EC2 instances in the VPC forward DNS queries out to on-premises DNS servers.
-
Why do you need to plan CIDR ranges carefully?
Show answer
Overlapping CIDRs make it impossible to peer VPCs (VPC Peering does not work with overlapping CIDRs). With Transit Gateway, overlapping CIDRs cause routing ambiguity. Multi-account environments need non-overlapping CIDRs across all VPCs/accounts. AWS IPAM helps centralize CIDR management. Plan from the start: assign CIDR ranges per account/Region (for example: 10.0.0.0/8 for the whole org, split into /12 per region, /16 per account).
-
What are the Transit Gateway attachment types?
Show answer
VPC attachment, VPN attachment (Site-to-Site VPN), Direct Connect Gateway attachment, Transit Gateway Peering (cross-region), Connect attachment (SD-WAN via GRE tunnel), Peering attachment (cross-account TGW peering). Each attachment can be associated with its own route table in the TGW to control routing. All connections route through the TGW, with no need for direct connections between them.
-
How do you isolate Prod and Dev traffic?
Show answer
Multiple route tables in the TGW: create a "Prod route table" and a "Dev route table". Prod VPC attachments associate with the Prod route table; Dev VPC attachments associate with the Dev route table. The Prod route table has no routes to Dev VPCs → Prod cannot reach Dev. The Dev route table can include Shared Services routes (logging, CI/CD) but no Prod routes. Elegant network segmentation without needing a separate TGW.
-
How does ECMP help VPN bandwidth?
Show answer
Equal-Cost Multi-Path routing with TGW lets you load balance traffic across multiple VPN tunnels or connections simultaneously. Each Site-to-Site VPN has 2 tunnels, each tunnel ~1.25 Gbps. With ECMP on TGW: multiple VPN connections on the same path → aggregate bandwidth. Example: 4 VPN connections × 2 tunnels × 1.25 Gbps = ~10 Gbps effective bandwidth. ECMP requires BGP with route propagation to work.
-
Does Transit Gateway Peering support BGP?
Show answer
No. TGW Peering (cross-region TGW to TGW) uses static routes, not BGP. You must manually add static routes for cross-region prefixes in the TGW route tables. This differs from VPN attachments and DX attachments (which support BGP). TGW Peering is a Layer 3 connection with the bandwidth limits and latency of cross-region connectivity. It suits global architectures that need inter-region connectivity.
-
How is Transit Gateway priced?
Show answer
Two components: (1) Attachment fee ($0.05/hour per attachment): each VPC, VPN, DX connection attached to the TGW is billed hourly, (2) Data processing fee ($0.02/GB): each GB that passes through the TGW. Compare with VPC Peering: no attachment fee, no processing fee, only cross-AZ data transfer. TGW is more expensive but scalable. Cost planning: with 20 VPCs: 20 × $0.05 × 730h ≈ $730/month in attachment fees alone.
- How do Private VIF, Public VIF, and Transit VIF differ?
Show answer
Private VIF: connects to a specific VPC via a Virtual Private Gateway, accessing the private IP space in the VPC. Public VIF: connects to AWS public endpoints (S3, EC2 public IPs, CloudFront origins); traffic goes over DX but to public IP space. Transit VIF: connects to a Transit Gateway; one VIF serves many VPCs. A Transit VIF requires a DX Gateway. Choose: Private VIF for 1 VPC, Transit VIF for many VPCs, Public VIF for S3/public services.
- What is a Direct Connect Gateway used for?
Show answer
A DX Gateway lets 1 DX connection access many VPCs across multiple Regions and accounts. Without a DX Gateway: 1 Private VIF connects to only 1 VPC. With a DX Gateway: 1 Private VIF → DX Gateway → many VGWs (Virtual Private Gateways) in different VPCs. It is also used with Transit Gateway (Transit VIF → DX Gateway → TGW). A DX Gateway is a global resource and does not belong to any Region.
- What should a High Availability design include?
Show answer
(1) Redundant DX connections from two different DX locations (not the same physical facility), (2) Redundant customer routers (not a single router), (3) Diverse cross-connects in the DX location, (4) VPN backup in case all DX fails (VPN over the internet with automatic failover), (5) BGP failover configured correctly (DX route preference higher than VPN). Maximum HA: 2 DX locations × 2 connections/location + VPN backup.
- What is a Link Aggregation Group (LAG)?
Show answer
A LAG bundles multiple DX connections into one logical connection using LACP (Link Aggregation Control Protocol). Example: 4 × 1 Gbps connections in a LAG = a 4 Gbps logical link. Benefits: aggregate bandwidth, active-active (load balance) or active-standby redundancy, a single management point. All connections in a LAG must have the same speed, the same DX location, and the same port type (dedicated). Maximum 4 connections per LAG.
- Why do you need a VPN backup for Direct Connect?
Show answer
DX has an SLA, but the SLA level depends on the architecture: 99.99% only with Maximum Resiliency (≥2 locations, ≥2 connections per location), 99.9% with High Resiliency (2 locations, 1 connection/location), while a single connection gets only 95%: one cut fiber or DX location maintenance and you lose connectivity. So with a single DX connection, you need a VPN backup over the internet (or a second DX connection) to keep connectivity when DX fails. BGP config: DX routes have higher preference (lower MED/higher local preference) → DX is used when available; when DX fails, BGP converges and traffic reroutes over VPN automatically. VPN bandwidth is lower than DX but enough for failover.
- A company has data centers in New York and London, each already with Direct Connect. They want to drop the MPLS circuit between the 2 DCs. What is the solution?
Show answer
Use Direct Connect SiteLink: enable SiteLink on the VIFs (attached to the same DX Gateway) at both DX locations → New York ↔ London traffic flows directly over the AWS global backbone, without going through any Region/VPC and without MPLS. Cost: per hour for each SiteLink-enabled VIF + data transfer between the 2 DX locations, usually cheaper than maintaining a cross-country MPLS WAN. Keyword: "connect data centers to each other using Direct Connect", "avoid/retire MPLS between sites" → SiteLink.
Hands-on Exercises
Part 1: VPC Advanced Concepts
- Create S3 Gateway Endpoint
- Create Interface Endpoint for Secrets Manager
- Setup VPC Peering between 2 VPCs
- Configure Route 53 Private Hosted Zone
Part 2: Transit Gateway Deep Dive
- Create Transit Gateway
- Attach 2 VPCs
- Configure route tables for segmentation
- Setup VPN attachment (optional)
Part 3: AWS Direct Connect
- Study Direct Connect location map
- Design an HA architecture for on-premises
- Calculate bandwidth requirements
- Review pricing calculator
References
- VPC Peering Guide
- VPC Endpoints
- AWS PrivateLink
- Transit Gateway Guide
- Transit Gateway Attachments
- Transit Gateway Route Tables
- AWS Direct Connect User Guide
- Direct Connect Virtual Interfaces
- Direct Connect Resiliency
- Direct Connect SiteLink
- Dedicated connections — 1/10/100/400 Gbps
- AWS Direct Connect SLA