Articles → AWS → NAT Gateway In AWS

NAT Gateway In AWS






What Is NAT Gateway?





How To Create A NAT Gateway?




  1. Create a private subnet
  2. Create a new route table
  3. Associate the subnet with the route table
  4. Launch two EC2 Linux instances
  5. Enable OpenSSH Authentication Agent service
  6. Log in to the Linux instance using the SSH utility
  7. Ping Google
  8. Create a NAT gateway
  9. Add an entry of NAT gateway in the route table
  10. Ping Google again



Create A Private Subnet




Picture showing the private subnet created in AWS console



Create A New Route Table




Picture showing a new route table created in AWS console



Associate The Subnet With The Route Table




Picture showing associating the route table with private network



Launch Two EC2 Linux Instances




Picture showing the 2 Linux EC2 instances created in AWS console



Enable Openssh Authentication Agent Service




Picture showing changing the Openssh Authentication Agent Service startup type as Manual




ssh-agent.exe



Log In To The Linux Instance Using SSH Utility




ssh-add -k karan.pem




Picture showing the ssh-add command for adding the private key in SSH authentication agent




ssh -A ec2-user@<Public IP address of EC2 instance>


Picture showing connecting the Linux virtual machine using ssh utility




ssh ec2-user@<Private IP of EC2 instance>


Picture showing connecting to second EC2 instance using SSH utility



Ping Google




ping google.com




Picture showing the error when pinging Google.com



Create A NAT Gateway




Picture showing the NAT Gateways menu in VPC dashboard




Picture showing the Create NAT gateway button for adding the new NAT Gateway




FieldValue
NameAny custom name of the NAT gateway.
SubnetSelect the Public subnet.
Elastic IP allocation IDSelect the elastic IP. If an elastic IP does not exist, then click on the “Allocate Elastic IP” button to create it.


Picture showing the screen to create NAT Gateway





Add An Entry Of NAT Gateway In The Route Table




Picture showing the screen to add network gateway as route in route table



Ping Google Again




Picture showing the ping to Google successfully



Posted By  -  Karan Gupta
 
Posted On  -  Wednesday, July 27, 2022

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250