LAB :Configure Transit Gateway Peering between Two VPC
LAB: Configure Transit Gateway Peering between Two VPC
Create 2 VPC with a public and private subnet. Launch EC2 Instances in both VPC and establish peering between them.
Refer below Topology to enable peering between two VPC via Transit gateway.
- Create the VPC Dclessons-prod-VPC with CIDR 10.10.0.0/16 in N Virginia region.
- Create a Public subnet DCLESSONS-PROD-SUBNET (10.10.0/0/24) in Dclessons-prod-VPC
- Create and attach an Internet Gateway in Dclessons-prod-VPC.
- Create a Public Route Table Dclessons-Default-Prod-RT and associate it with the subnet
- Add public Route 0.0.0.0/0 pointing to IGW in the Route table Dclessons-Default-Prod-RT
- Launch an EC2 instance in the Dclessons-prod-VPC
- Create a Second VPC DCLESSONS-DEV-VPC with CIDR 10.11.0.0/16 in Ohio Region.
- Create a Private subnet Dclessons-Dev-Subnet (10.11.0.0/24) in DCLESSONS-DEV-VPC
- Launch an EC2 instance in DCLESSONS-DEV-VPC
- Create a Transit gateway. Create two Transit gateway attachment for the each VPCs created
- Add the routes for 10.11.0.0/16 in the First VPC’s route table
- Add the routes for 10.10.0.0/16 in the Second VPC’s route table
- Test the connectivity between two VPCs
Create VPC in N.Virginia Region | In VPC Setting Name: Dclessons-prod-VPC | CIDR : 10.10.0.0/16 | Click Create VPC.
Under Subnet | Select VPC: Dclessons-Prod-VPC | Subnet name: DCLESSONS-PROD-SUBNET | AZ: us-east-1a| IPv4 CIDR: 10.10.0.0/24
Under Internet gateway | Create Internet Gateway: Name: Dclessons-PROD-IGW | Click Create Internet gateway
Attach this IGW to PROD VPC | Click Attach Internet gateway
Under Route table Section | Select Default Route table for this Subnet : We have renamed it to Dclessons-Default-prod-RT | Under Routes : Edit Routes.
Add 0.0.0.0/0 routes pointing towards IGW and click Save Routes.
Now launch a Amazon EC2 instance in PROD VPC (We have already did a lot) and access it.
Now Create DEV VPC in Ohio region. Refer below figure for VPC Configuration.
Under Subnet section | Select DCLESSONS-DEV-VPC in VPC ID and Subnet name: Dclessons-DEV-Subnet | AZ: us-east-2a | Subnet 10.11.0.0/24
Now Launch an EC2 instance in DEV VPC (We have already did a lot).
Now under same region Ohio, Select Transit gateway | Click create transit gateway
Under create transit gateway Name: Dclessons-DEV-ohio-TGW, keep all option default and click create transit gateway.
Now we will create Transit Gateway Attachments, click to create Transit gateway attachments
In Create Transit Gateway attachments section | Name: TGW-DEV-VPC and select Transit GW ID: Dclessons-DEV-ohio-TGW and attachments type: VPC. | Select VPC DCLESSONS-DEV-VPC and its related subnet.
Now we will see Transit Gateway Route tables, here we will use Default Transit GW RT and we have renamed it TGW-DEV-Default-RT for DEV TGW. Select that Route Table | Select Association, here you can see association has been done and propagation has been enabled.
Now Click on Routes, you will see that 10.11.0.0/16 routes is installed in TGW-DEV-Default-RT.