Amazon Virtual Private Cloud (Amazon VPC) is a service that lets you launch AWS resources in a logically isolated virtual network that you define. You have complete control over your virtual networking environment, including a selection of your own IP address range, creation of subnets, and configuration of route tables and network gateways. You can use both IPv4 and IPv6 for most resources in your virtual private cloud, helping to ensure secure and easy access to resources and applications. When we create VPC so it will create two services automatically like NACL and route table.
Now we will learn about
SUBNET. (PRIVATE / PUBLIC)
So first we will create a VPC with “EMT TAG”
When you logged in AWS then you will see this screen and select on which service you want to work, for example we are going to create VPC, so click on that.
How to create VPC? You will see this screen,
First we create VPC, click on that and then you will see this image
Click on create VPC , then you will see this image
Define the details in that like
Name tag = EMT-VPC (suitable as per project) IPV4 CIDR Block = 184.108.40.206/16
IPV6 CIDR Block = select as per the requirement now we are selecting “ No IPV6 CIDR Block” Tenancy = Default
Now click on create and your VPC is created, you will see VPC id.
And now click on “Actions” to edit DNS Hostname and enable it because by default it is not enabled.
Subnet or subnetwork is a network inside a network(like VPC), Subnets make networks more efficient. Through subnetting, network traffic can travel a shorter distance without passing through unnecessary routers to reach its destination.
How we can make public or private subnets?
By default all subnets all private, We need to attach “route table which has internet gateway” to the subnet to make it public and attach route table without internet gateway to make it private.
Now we are going to create subnet. Click on subnet, you will see on the left side of the screen.
Now click on create subnet, after that you will this image.
Now define all the details.
Name Tag = EMT-PUBLIC-SUBNET
VPC = select VPC (which we created EMT-VPC)
Availability Zone = drop down you will see mutli AZ, (select which one you want but if you are creating multi instances then define different AZ for High availability or any disaster.)
VPC CIDRs = It comes automatically because you already define VPC. IPV4 CIDR Block = 10.0.10.0/24 (define according to the VPC).
Now click on create button, your subnet is ready.
Bydefault subnet does not allow to auto-assign public IP to the instance, we need to enable the settings of Auto-assign “Public IP”. Go to action and modify auto assign IP settings and enable auto-assign public IPV4 then save.
Now we will create Internet gateway and attached to the VPC to get internet access. Click on create internet gateway,
Define the name of internet gateway and click on create it. Name Tag = EMT-IGT
You will see internet gateway is created, but you will see its detached, so first we will attach with the VPC.
Now select EMT-IGT and click on actions then select “attach to VPC”
Now you will get this image
Select the VPC on which you want to attach like EMT-VPC
Now click on attach and your IGT is attached with the VPC.
Now we have to select “Route Tables” which is automatically create when we create vpc. Check with VPC name which RT is created.
Now define name to the route table “EMT-RT”
Click on edit routes button you will get this image
Now add routes attach internet gateway allow all traffics
click on save routes.
Now your VPC is ready with route table, internet gateway, subnets.
Check out : CREATE AN EC2 INSTANCE ON AWS