
Centralized VPC Endpoints with AWS Transit Gateway: Optimizing Multi-Account Network Topology
A technical guide to centralizing AWS VPC Endpoints with AWS Transit Gateway: configure hub-and-spoke routing, Route 53 private hosted zones, and cost-optimized multi-account network topologies.
As cloud environments expand across multiple AWS accounts and Virtual Private Clouds (VPCs) under AWS Organizations, managing secure connectivity to native AWS services (such as Amazon S3, Amazon DynamoDB, AWS Secrets Manager, and Amazon ECR) introduces operational overhead and ballooning network costs.
Deploying dedicated AWS PrivateLink VPC Endpoints (Interface Endpoints) inside every application VPC provides security by keeping traffic off the public internet, but it rapidly inflates costs: each interface endpoint incurs an hourly provisioning fee per Availability Zone, multiplied across every VPC.
By building a hub-and-spoke network topology powered by AWS Transit Gateway (TGW) and Amazon Route 53 Private Hosted Zones, platform teams can centralize VPC endpoints into a dedicated shared services VPC, eliminating duplicate endpoints while maintaining strict network isolation.
1. The Cost & Complexity Problem: Distributed vs. Centralized Endpoints
In an unoptimized multi-VPC architecture, each spoke VPC provisions its own Interface Endpoints:
Distributed Model (High Cost):[VPC A (App 1)] ──► [Endpoint: Secrets Manager] ($/hr * AZs)[VPC B (App 2)] ──► [Endpoint: Secrets Manager] ($/hr * AZs)[VPC C (App 3)] ──► [Endpoint: Secrets Manager] ($/hr * AZs)
Centralized Model (Hub-and-Spoke):[VPC A (App 1)] ──┐[VPC B (App 2)] ──┼──► [AWS Transit Gateway] ──► [Shared Services VPC] ──► [Shared VPC Endpoints][VPC C (App 3)] ──┘Evaluation Metric | Distributed Endpoints | Centralized Endpoints via Transit Gateway |
|---|---|---|
Endpoint Hourly Cost | Multiplied by $N$ VPCs $\times$ $M$ AZs $\times$ Services. | Fixed to 1 Shared VPC $\times$ $M$ AZs $\times$ Services. |
Data Processing Cost | Endpoint data processing fees only. | Endpoint processing fees + TGW data processing ($0.02/GB). |
DNS Management | Local default private DNS names. | Requires centralized Route 53 Private Hosted Zones & Inbound Resolvers. |
Security Surface | Dispersed endpoint policies across every account. | Centralized endpoint policy and security group management. |
Break-Even Threshold | Cost-effective for 1–3 small VPCs. | Significantly cheaper once environments exceed 4–5 spoke VPCs. |
2. Architectural Blueprint: Traffic Flow and DNS Routing
To make centralized endpoints transparent to workloads in spoke VPCs, the architecture relies on three coordinated components:
[Spoke VPC (Account A)] │ │ 1. DNS Query for "secretsmanager.us-east-1.amazonaws.com" ▼[Route 53 Resolver] ──(Associated with Private Hosted Zone)──► Resolves to Shared VPC ENI IP │ │ 2. HTTPS Traffic directed to Shared VPC IP (e.g., 10.100.2.45) ▼[AWS Transit Gateway] │ (Routes via TGW Route Tables) ▼[Shared Services VPC (Network Hub)] │ ▼[Interface VPC Endpoint (ENI)] ════(AWS PrivateLink)════► [AWS Secrets Manager]1. The Shared Services (Hub) VPC
Create a dedicated VPC hosting private subnets spread across target Availability Zones (e.g.,
us-east-1a , us-east-1b ). Deploy the required Interface Endpoints here with:- Private DNS Disabled: When creating the endpoints in the shared VPC, disable the default AWS Private DNS setting to prevent conflicting with local VPC DNS resolutions.
- Permissive Ingress Security Groups: Allow incoming HTTPS (TCP port 443) from the CIDR blocks of all authorized spoke VPCs.
2. Route 53 Private Hosted Zones
Create a Route 53 Private Hosted Zone (PHZ) in the networking account matching the exact public DNS name of the service (e.g.,
secretsmanager.us-east-1.amazonaws.com ).- Add alias
Arecords pointing directly to the private IP addresses of the Elastic Network Interfaces (ENIs) generated by the endpoint in the shared VPC.
- Associate this Private Hosted Zone with all authorized spoke VPCs across your AWS Organization via AWS RAM (Resource Access Manager) or automated cross-account PHZ association scripts.
3. Transit Gateway Routing Configuration
AWS Transit Gateway route tables isolate network segments and govern inter-VPC traffic.
TGW Spoke Route Table:- 0.0.0.0/0 ──► Egress / NAT Gateway Attachment (Optional)- 10.100.0.0/16 ──► Shared Services VPC Attachment (Endpoints)
TGW Shared Services Route Table:- 10.0.0.0/8 ──► Propagated from Spoke VPC AttachmentsAppliance Mode Considerations
When traffic passes through Transit Gateway to reach endpoints, stateful firewalls or multi-AZ setups can encounter asymmetric routing. Ensure Transit Gateway attachments on the shared services VPC have Appliance Mode enabled if third-party firewall inspection appliances sit in the path of the endpoints.
4. Operational Best Practices and Governance
- Automate PHZ Associations: Use AWS CloudFormation StackSets or AWS Organizations lifecycle events (EventBridge + Lambda) to automatically associate the central Route 53 Private Hosted Zones whenever a new Spoke VPC is provisioned.
- Enforce VPC Endpoint Policies: Centralizing endpoints allows security engineers to attach strict IAM endpoint policies in one place. Restrict access to organizational resources only:
JSON
{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowOrgOnly", "Effect": "Allow", "Principal": "*", "Action": "*", "Resource": "*", "Condition": { "StringEquals": { "aws:PrincipalOrgID": "o-abcdef1234" } } } ]}- Monitor MTU Limits: Transit Gateway supports an MTU of 8500 bytes (Jumbo frames) for VPC attachments. Ensure spoke workloads and network interfaces are configured consistently to maximize throughput and reduce packet fragmentation.
Centralizing VPC Endpoints with AWS Transit Gateway bridges the gap between enterprise security compliance and cloud financial prudence. By routing service calls through a controlled hub VPC and managing DNS resolution via Route 53 Private Hosted Zones, platform teams preserve zero-internet transit paths while cutting redundant endpoint infrastructure expenses across their cloud footprint.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article