Networking project: set up the infra for outbound traffic from an EC2 instance inside a private subnet in a VPC to be possible with NAT Gateway

AWS Project: VPC with a public subnet containing a NAT gateway. The NAT gateway can be used for outbound traffic to the internet from the EC2 instance in the private subnet. 

A route table connects the destination 0.0.0.0/0 to the internet gateway for the public subnet. In the public subnet, there is an EC2 instance that can be accessed via SSH through the correct security group settings.Using the EC2 instance in the public subnet, the EC2 instance in the private subnet can be accessed by saving the private key on the EC2 instance in the public subnet. This is done by using a text editor like vim on the EC2 instance in the public subnet, pasting the content of the private key (the .pem file from the local computer) in the newly created file (command “vim private_key.pem”). Then permission of the file needs to be changed with the command “chmod 400 private_key.pem” which will ensure that only your user can access the file. 

This type of infrastructure is a bare bones example of project containing a website (which runs on the EC2 instance in the public subnet) and a database (which runs on the EC2 instance in the private subnet). 

Lader Bezig met laden…
EAD logo Duurt het te lang?

Opnieuw laden Laad het document opnieuw
| Open Openen in nieuwe tab

Leave Comment