Working With NAT Gateway
- For providing outbound internet connectivity on private EC2 we can created NAT Gateway in public subnet, this will help private EC2 instance to download patches or anything from the internet
- For creating NAT gateway go to VPC service > Create NAT Gateway
- Select Public Subnet > Create New EIP > Create a NAT Gateway
- Click Edit route tables
- Select Private Route Table > Routes > Edit
- Add a 0.0.0.0/0 pointing to NAT Gateway and save it
- Now go to Public EC2 instance in which we have opened up SSH session for Private EC2
Try to ping 8.8.8.8, you get the ping result from your private EC2
- You delete the NAT gateway now, and check ping drops. Don’t delete public and private EC2 yet will need it for next lab