Create VPC , Public, Private subnets, NAT Gateway, IGW

Following are the steps:
1) Create VPC
2) Create subnets
3) Create and attach Internet Gateway to VPC
4) Attach Internet Gateway to default route table
5) Creating an additional route table for private subnets and public subnets.
Let us get started:
1)Open AWS Console select a region from top left , and on services search VPC,
click on your vpcs on the left and the create vpc
Name tag : project-vpc CIDR: 10.0.0.0/16 (range can only be between 16 to 28, 16 being the max) 
2)For  subnet: 4 subnets -
2 private and 2 public
give proper names and associate 251 ips by giving CIDR block like
public-subnet-us-west-2a - > 10.0.1.0/24
public-subnet-1b -> 10.0.2.0/24
private-subnet-1a -> 10.0.3.0/24
private-subnet-1b  -> 10.0.4.0/24
Till now the configuration for public and private subnets will be same attaching a route table will make a difference!!
3) For IGW
Create an Internet Gateway and attach it to our vpc named "project-vpc"
note: 1 Internet Gateway can only be attached to 1 VPC 4) Route Table
Gets created whenever we create a vpc.
Make sure it accepts our traffic from outside, for that under route table add our Internet Gateway.
on destination: 0.0.0.0/0
on IGW name add your Internet gateway ID
5) Create 2 route tables named public and private route table for your VPC.
Private route table: To private route table attach a NAT gateway or NAT Instance.
1) NAT Gateway: On NAT Gateway choose a public subnet of the VPC, as NAT Gateway must be under a public subnet.
2) Elastic IP: It is mandatory to create an Elastic IP.
After this click on create NAT Gateway.
3) Open Route Table again and add the created NAT Gateway to Private subnet Route Table:
Destination: 0.0.0.0/0, Target: NAT-gateway-id
Add the private subnets to the private route table by subnet association.
 Hola! now you have 2 route table:
a- private route table with a NAT gateway attached with subnet association of private subnets.
b- main route table which we renamed as public route table which now by default have 2 public subnets (2 private subnets were detached automatically after the subnet association we used in step a), this public route table also have an IGW attachedto it.

Comments

Popular Posts