Sub topic 2
Pointing VPC Routes at the Transit Gateway
Assume you know CIDR blocks, subnets, VPC route tables, security groups, and basic AWS CLI usage. A transit gateway (TGW) is a regional router. It does not automatically change the route tables inside your VPCs.
Pointing VPC routes at the transit gateway
Add a route for each remote network to the route table used by the source subnet. The route targets the TGW. For example, this route sends traffic for VPC B to the TGW:
aws ec2 create-route \
--route-table-id rtb-0123456789abcdef0 \
--destination-cidr-block 10.1.0.0/16 \
--transit-gateway-id tgw-0123456789abcdef0The TGW must also have a route for 10.1.0.0/16, usually learned through route propagation from VPC B. Return traffic needs the reverse path: VPC B's subnet route table must send the source VPC's CIDR to the same TGW.
Isolating environments with separate route tables
A TGW route table controls where an attachment's traffic can go. Associate an attachment with one TGW route table. Enable propagation into that table only when its CIDR should be reachable there.
For example, associate production VPCs with a production TGW route table and development VPCs with a development table. Omit propagation or add explicit routes when environments must remain isolated. This is more precise than placing every attachment in one shared table.
PrivateLink: exposing a service, not a network
AWS PrivateLink provides private access to one service. The consumer receives elastic network interfaces through an interface VPC endpoint. The consumer does not receive routes to the provider's subnets, and the two VPCs do not become mutually reachable.
Use PrivateLink when a team should consume an API or application without accessing the provider's whole network.
Publishing an endpoint service from a Network Load Balancer
The provider places a Network Load Balancer (NLB) in front of the service, creates an endpoint service, and permits selected consumer accounts. Manual acceptance adds an approval step.
aws ec2 create-vpc-endpoint-service-configuration \
--network-load-balancer-arns arn:aws:elasticloadbalancing:us-east-1:111122223333:loadbalancer/net/my-svc/0123456789abcdef \
--acceptance-required
aws ec2 modify-vpc-endpoint-service-permissions \
--service-id vpce-svc-0123456789abcdef0 \
--add-allowed-principals arn:aws:iam::444455556666:rootThe consumer then creates an interface endpoint, and the provider accepts the connection.
Exercise
A consumer needs one private API but must not reach the provider VPC's other subnets. Should you use a TGW route or PrivateLink?
Show answer
Use PrivateLink. It exposes the selected service without providing network-level connectivity.