- Newest
- Most votes
- Most comments
The scenario you have described should work. Please see the example below: Centralized outbound routing to the internet:
https://docs.aws.amazon.com/vpc/latest/tgw/transit-gateway-nat-igw.html
Hello,
please try this steps it will be helpful for you & please look at AWS Document link you will get more information.
https://docs.aws.amazon.com/vpc/latest/tgw/transit-gateway-nat-igw.html
STEPS VPC A is private and located in Account A. VPC B is public, contains an Internet Gateway (IGW), and is located in Account B with the TGW. TGW is in Account B and connects both VPC A and VPC B.
Steps to Achieve Internet Access from VPC A:
1. Ensure Transit Gateway Attachments
VPC A Attachment: Ensure VPC A is attached to the TGW in Account B. VPC B Attachment: Ensure VPC B is attached to the TGW in Account B.
2. Configure Route Tables
VPC A (Private VPC in Account A) Route Table for Private Subnets: Route: 0.0.0.0/0 Target: Transit Gateway (TGW Attachment ID for VPC A)
VPC B (Public VPC in Account B) Route Table for Public Subnets: Route: 0.0.0.0/0 Target: Internet Gateway (IGW)
Transit Gateway Route Table
TGW Route Table: Route: CIDR of VPC A Target: TGW Attachment ID for VPC A Route: 0.0.0.0/0 Target: TGW Attachment ID for VPC B
3. Configure Security Groups
VPC A Security Groups:
Allow outbound traffic to the internet.
VPC B Security Groups:
Allow inbound and outbound traffic from VPC A and the internet.
Example Configuration
-
Route Table for VPC A Private Subnets Go to the VPC console in Account A. Navigate to Route Tables. Select the route table associated with the private subnets. Add the following route: Destination: 0.0.0.0/0 Target: TGW Attachment ID for VPC A
-
Route Table for VPC B Public Subnets Go to the VPC console in Account B. Navigate to Route Tables. Select the route table associated with the public subnets. Ensure the following route exists: Destination: 0.0.0.0/0 Target: Internet Gateway (IGW)
Transit Gateway Route Table
Go to the TGW console in Account B. Navigate to Route Tables. Select the route table associated with the TGW. Add the following routes: Destination: CIDR of VPC A Target: TGW Attachment ID for VPC A Destination: 0.0.0.0/0 Target: TGW Attachment ID for VPC B
Test:
Launch an EC2 Instance in VPC A (in the private subnet). Test Internet Access: Try to ping a public IP or resolve a domain name to ensure internet connectivity.
Relevant content
asked 2 years ago
asked 4 years ago
- AWS OFFICIALUpdated 4 years ago
