VPC Tutorial #2: How to set-up AWS VPC Transit Gateway a step-by-step guide
In this article you will get to know how to set-up transit gateway with 10 steps guide!! I have attached screenshots and all the necessary instructions as well. I suppose you possess a why/what of VPC and its terminologies.
Topics Covered -
1. VPC and Its Components creations
VPC
Subnets
Route Tables
Internet Gateway
Security Groups
2. EC2 (Elastic Compute Cloud)
Launching an EC2 Instance: Step-by-step guide on how to launch and configure an EC2 instance.
Key Pairs
Security Groups
3. Transit Gateway
Setting Up a Transit Gateway: Step-by-step guide to configure and use Transit Gateway.
Connecting Multiple VPCs with the help of Transit gateway attachments
Peering vs. Transit Gateway: A comparison between VPC peering and Transit Gateway.
Create VPC 1 and its components [IGW, Subnets, Route table] → we will follow a hands-on approach to set-up transit gateway with below steps, first we need to create VPC then will create and attach IGW, then public and private subnets, and finally will create and update routes in route tables. pls follow along with the screen shots given.
In real-time scenario you might have to deal with multiple aws vpc’s of different accounts and/or different regions and/or on prem data center. Using transit gateway we plan to create a hub-spoke network which securely connects each other using public ip’s.
I have miss the IGW attachment screenshot after IGW creation step, please follow steps from VPC2/VPC3 for reference.
Create VPC 2 and its components [IGW, Subnets, Route table] →
Create VPC 3 and its components [IGW, Subnets, Route table] →
Launch Public instance 1 in VPC 1 →
Add keyPair (either create it or used existed)
Use VPC1 and Public Subnet
Enable auto assign public IP
Open SSH and HTTP port
Add User Data for nginx web page
Launch Public instance 2 in VPC 2 → Follow the same steps as server1
Add keyPair (either create it or used existed)
Use VPC2 and Public Subnet
Enable auto assign public IP
Open SSH and HTTP port
Add User Data for nginx web page
Launch Public instance 3 in VPC 3 → Follow the same steps as server1
Add keyPair (either create it or used existed)
Use VPC2 and Public Subnet
Enable auto assign public IP
Open SSH and HTTP port
Add User Data for nginx web page
You can heat Public IP of each instance to browser and test nginx page. eg.
Success!!
Create transit gateway →
Keep all the default settings and heat create.
Create transit gateway attachments →we need to create 3 attachments /3vpc’s
Attachment type → select VPC
select vpc1 id
heat create attachment.
Now create attachment 2 and attachment 3 for vpc2 and vpc3 follow same steps
Update Route Tables → Update routes in all 3 rt’s.
Add all three attachments as follows double cross check routes !!
Test connections → curl “private ip”
open three terminal and establish a ssh connection. You need to copy .pem file first. You can copy .pem file and make it executable (using chmod 400 command ref aws console). save securely somewhere.
Success !! So we can able to ssh to private IP of other instances !!
Cleanup
delete EC2 instances
delete transit gateway attachments
delete transit gateway
delete VPC’s
Peering vs. Transit Gateway: A comparison between VPC peering and Transit Gateway.
VPC Peering
Direct connection between two VPCs.
It's simple, but no transitive routing, so you need separate connections for VPCs (let’s say if you have more than 2 vpc’s).
Transit Gateway
You can connect multiple VPCs through a single gateway (eg. Hub).
Usually used for complex architecture mix of multiple vpc’s of different regions/accounts, on-prem data centers.
It supports transitive routing.
Key Takeaway -
Setting up a VPC Transit Gateway may seem complex at first, but it's a powerful solution for connecting multiple VPCs and/with on-premises networks. By following this step-by-step guide, you now have a solid understanding of how to configure and use the Transit Gateway in AWS.
#AWS #VPC ##TransitGateway #AWSNetworking #CloudComputing #AWSCloud #CloudInfrastructure #AWSTutorial #Networking #CloudArchitecture #DevOps #CloudSecurity #NetworkingInAWS #NetworkManagement
Subscribe to my newsletter
Read articles from Shivprasad Waghmare directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Shivprasad Waghmare
Shivprasad Waghmare
"Accidental DevOps Engineer | 7+ Years of Experience | Exploring AWS, Kubernetes, Terraform, Docker, Jenkins | Passionate about automating cloud infrastructure | Let’s explore the world of DevOps together!"