transit-gateway

Without Transit Gateway

image

With Transit Gateway

image

Routing Sample:

image

Here we are doing the setup of Transite gateway on same aws account across three diffrent VPC's.

Demo Setup:

image

Steps:

  1. Create 3 VPC's and public and private subnets using below cloud formation tempalates.

     aws cloudformation --region us-east-2 create-stack --stack-name vpc1 --template-body file://vpc1_cfn.yaml
     aws cloudformation --region us-east-2 create-stack --stack-name vpc2 --template-body file://vpc2_cfn.yaml
     aws cloudformation --region us-east-2 create-stack --stack-name vpc3 --template-body file://vpc3_cfn.yaml
    
  2. Now create EC2 instance in each VPC's private subnet.

image

  1. Now will create transit gateway in default VPC

Uder VPC --> Transit Gateways --> create transit gateway

image

image

Keep all default options as it is.

image

image

  1. Create transit gateway attachment to all 3 vpc's

Goto VPC --> TRANSIT GATEWAYS --> Transit gateway attachments --> Create transit gateway attachment

image

Select private subnet.

image

Follow the same process for remaining two VPC's.

image

  1. Now will add Route Table entry for all 3 vpc Transit Gateway in respective VPC's private subnet route table.

image

For now we have added route from VPC1 to VPC2 and in VPC2 to VPC1

image

Now connect to private EC2 instance in VPC1 using session manager and try to do ssh. In the initial check I have not added route so it was giving timeout, later I added route then its started working.

image

Currently we dont have route from VPC2 to VPC3 so if we try to do ssh from vpc2 to vpc3 EC2 instance we should get error.

image

Now add the routes as below for all VPC's.

image