The Network we are talking on AWS is VPC and Subnets.
Subnet is where we host our Servers. we create 2 Subnets Private and Public.
Creating VPC:
login to your AWS console > Services > VPC
from VPC Dash Board > Create VPC
Enter a Name Tag and IPv4 address range while other 2 fields remain default.
once a VPC is created , we need an SUBNET to be created.
to create a subnet for our VPC, from VPC dashboard we need to click on Subnets, then click on “Create Subnet”
Enter the name for your subnet in name tag ,select the just created vpc under which you are willing to create subnets and choose Availability zone along with the IPv4 CIDR block address
repeat the same process to create second subnet
now you should be able to see the newly created subnets under vpc dashboard > subnets section
The Next step is to create a Public subnet. this involves creating a Internet Gateway (IG)
from VPC dashboard click on Internet Gateways > Create Internet Gateway
Give a Name to the internet gateway
Attach newly created IG to VPC
Now we need to create a new route table by selecting Route Tables and clicking on “Create Route Table”.
Create Route Table > Select Name and VPC
after creating Route Table , we need to create routes to the internet.for this select the newly created Route Table and click on Routes > Edit routes>Add route.
give the destination as 0.0.0.0/0 and the target as name of newly created “internet gateway” name
now lets associate a subnet that we want to make public to this route tables.
click on subnet associations > Edit subnet associations> select the subnet you want to have it as public facing.
Finally, since this subnet (10.x.x.0) is an internet facing subnet — lets go ahead and change the auto-assign an IP settings so that when EC2 instances are deployed they get a public IP.
So lets click on Subnets then select your public subnet and then click on “Modify auto-assign IP settings” from the Subnet Actions drop down menu.
Click the check box and save
with this a public facing subnet has been created, we will deploy web server on this subnet.
since for the other subnet we did not attach Internet Gateway it remains as Private on which we will deploy Applications Server and DB.
** for security reasons i have sourced few images from internet **