Case Study ยท Infrastructure ยท Terraform ยท AWS

AWS Transit Gateway Inter-Region Peering

Designing and provisioning multi-region AWS network infrastructure with Terraform โ€” connecting Mumbai and Hyderabad VPCs via Transit Gateway, with private SSM access and a modular IaC pattern built to scale.

RoleCloud Infrastructure Architect
PlatformAWS ap-south-1 & ap-south-2
DomainNetwork Infrastructure / IaC
TypeTerraform Infrastructure Module

Two regional workloads that needed to talk โ€” privately, without a public internet hop

Production workloads in Mumbai (ap-south-1) needed private communication with the DR tier in Hyderabad (ap-south-2). EC2 instances in private subnets also needed SSM Session Manager access without public IPs or a bastion host.

Constraint: 100% Terraform-managed. Adding a third region must require only a new module call โ€” no changes to existing code.

Hub-and-spoke Transit Gateway topology

1
VPC Module โ€” reusable per regionProvisions complete VPC: CIDR block, public/private subnets across 2 AZs, IGW, NAT Gateway per AZ, route tables. Called once per region with different CIDRs to avoid overlap.
2
Transit Gateway per regionOne TGW in Mumbai, one in Hyderabad. VPC attachments connect regional VPCs to their local TGW. Route propagation enabled so VPC routes are automatically shared.
3
Inter-region TGW Peeringaws_ec2_transit_gateway_peering_attachment connects Mumbai to Hyderabad TGW. Acceptance handled via cross-region provider alias (provider = aws.hyderabad).
4
VPC Endpoints for SSM on private subnetsThree Interface endpoints per VPC: ssm, ssmmessages, ec2messages. EC2 instances in private subnets accessible via SSM without public IP or bastion.
5
Least-privilege Security GroupsApplication SGs allow traffic only from TGW attachment CIDRs. SSM endpoint SG allows HTTPS inbound from VPC CIDR only.

Cross-region Terraform is non-trivial

Infrastructure as code โ€” zero console drift

100%
Infrastructure managed via Terraform
0
Public IPs on EC2 instances
SSM
Bastion-free private access
Modular
3rd region = 1 module call

Back to all projects