VPC-Document
VPC-Document
What is VPC?
• A Virtual Private Cloud (VPC) is a logically isolated section of the AWS cloud where you
can launch AWS resources in a virtual network that you define.
• You have complete control over your virtual networking environment, including the
ability to create your own IP address range, create subnets, configure route tables, and
gateways.
It ensures that sensitive traffic remains protected while accessing resources like
databases, file servers, or APIs from on-premises networks.
2. SUBNET:
A segment within the VPC's IP range, used to divide resources logically and
ensure efficient network organization. Subnets can be public or private based on their
use case.
In this Subnet, there are two types in it such as Public Subnet and Private
Subnet. For example, A private subnet is used to secure a database, while a public
subnet hosts application servers exposed via a load balancer.
3. ROUTE TABLE:
Defines the traffic routing rules within a VPC and to control the flow of traffic to
and from subnets.
For Example, routing public internet traffic through the Internet Gateway and
private traffic through the NAT Gateway.
5. NAT GATEWAY:
Allows outbound internet access for private resources while keeping them
secure.
➢ VPC:
Acts like the house for your entire e-commerce system, giving it a private space
to run securely and efficiently.
➢ SUBNETS:
Allows your public website to connect to the internet so customers can browse
and shop online.
➢ NAT GATEWAY:
1. The public subnet (10.0.1.0/24) hosts an EC2 instance with direct internet access
through an Internet Gateway (IGW), ideal for web servers.
2. The private subnet (10.0.3.0/24) hosts an EC2 instance without direct internet access
for security. Outbound traffic uses a NAT Gateway.
3. The NAT Gateway, with an Elastic IP, allows private instances to access the internet for
updates or external services without exposing them to incoming traffic.
After the Route process, we also need to do Subnet Association. Because, Subnet
association is required to bind the correct route table to its respective subnet so that
the traffic follows the desired path (Internet Gateway for Public Subnet, NAT Gateway for
Private Subnet).
➢ Subnet Association:
• Click on the Route Table ID (e.g., VPC-PUBLIC-RT).
• Navigate to the Subnet Associations tab.
• Click Edit Subnet Associations and Associate it as below.
• For Public Route Table, select Public Subnet (e.g., 12.0.1.0/24).
➢ Also, we need to do the above step for Private Subnet Association in Route Table.
Step 6: Launch EC2 Instances
Here is the main thing that if we need to login to our Private Instance means, first we need to
Login to Public Instance.
Then, Open Remote Desktop Connection RDC (Windows Server used here) in that Public
Instance and Enter the Private IP address of the Private Instance. Because, we don’t provide
public IP for this instance.
When accessing it, it will ask Username and Password. To get that, we need to select the
Private Instance and click connect button. You’ll have that page as below,
From that Image, you’ll get the Private IP and Username visibly. In order to get the Password,
Click on Get password. You’ll get a page as below,
Here, you need to upload the .pem file for the respective EC2 Instance. Then click on Decrypt
Password.
By doing all the above steps, you’ll get the VPC Connection with Public as well Private Instance.