In this article of the series of articles around VPC, we are going to learn and cover the below topics:
- Network architecture of VPC.
- Requirements for setting up VPC.
NETWORK ARCHITECTIRE OF VPC
Let us see how the actual network architecture of VPC looks like,

From the above image we can see that here we have 2 types of subnets.
Public and private subnet is a concept of VPC, and the public subnet is one which is connected to the internet gateway.
In the previous article we have already learned what Internet gateway is; it can be thought of like a modem which is connected to the internet.
In public subnets, traffic can go out and can come in from the internet.
For example: When we launch an EC2 instance we can easily do SSH using the intent which means that by default our instances are launched in a public subnet which can be accessed using the internet.
Private Subnet
We cannot connect to the instances in this subnet over the internet, but if instances in a private subnet want to connect to the internet, they can do it by using the NAT gateway placed in the public subnet. For example: If we need to install a package in an app sever placed in private subnet, then this can be downloaded from the internet via NAT gateway through a public subnet.
NAT gateway will be connected to the internet gateway.
Now the next question arises as to HOW TO LOGIN TO INSTANCES IN PRIVATE SUBNETS?
SOLUTION
For that we need to login to the EC2 instance(s) in a public subnet and from there we can do SSH to the other instances in a private subnet even if they are in a different AZ.

REQUIREMENTS FOR SETTING UP VPC
To achieve high availability, we need a minimum of 2 public subnets and a minimum of 2 private subnets as in the previous diagram. If Availability Zone B goes down then all the servers in Availability Zone B will not be accessible and we will not be able to access the app and DB server placed in private subnet in Availability Zone B.
So, if we want both public and private subnet and high availability at the same time then we need to create a minimum of 2 public subnets and 2 private ones, and also we need to place them in different zones as shown in the diagram below.


Join the conversation! Your thoughts help the community grow.