Creating a VPC with a Public Subnet and an Internet Gateway on AWS Cloud
Here I am extending this setup with a Private Subnet and a NAT Gateway.
Private Subnet is a subnet which is in the range of VPC and where we deploy the servers / resources which should not be accessed through internet.
In any case where the instances in this Private Subnet wants to go to internet, it should go through a NAT Gateway which is connected to a Public Subnet.
(click on the images to view in full size)
Create the Subnet
Go to Subnets under VPC dashboard and hit Create Subnet..
Create the NAT Gateway
Now let's create a NAT Gateway..
Go to NAT Gateways under VPC dashboard and hit Create NAT Gateway.
There you will need to select a Public Subnet. (Remember you should always select a public subnet for creation of NAT gateways because it uses one of the IPs from that public space)
Then hit Create New EIP (Elastic IP) and hit Create a NAT Gateway
Create and Configure a Route Table
Now go to the Route Tables under VPC dashboard.
Hit Create Route Table
Go to the Subnet Associations of the Private RT and Edit Subnet Associations and select the subnet you created (the one which should go public) and hit Save.
Then select the Routes tab and hit Edit Routes.
Give a default route (0.0.0.0/0) and select the target as the NAT Gateway you created and associated with the VPC.
Now let's create a NAT Gateway..
Go to NAT Gateways under VPC dashboard and hit Create NAT Gateway.
There you will need to select a Public Subnet. (Remember you should always select a public subnet for creation of NAT gateways because it uses one of the IPs from that public space)
Then hit Create New EIP (Elastic IP) and hit Create a NAT Gateway
Create and Configure a Route Table
Now go to the Route Tables under VPC dashboard.
Hit Create Route Table
Go to the Subnet Associations of the Private RT and Edit Subnet Associations and select the subnet you created (the one which should go public) and hit Save.
Then select the Routes tab and hit Edit Routes.
Give a default route (0.0.0.0/0) and select the target as the NAT Gateway you created and associated with the VPC.
No comments:
Post a Comment