
I created a VPC with both Public and Private Subnets
Introduction
Hemanth of Alliance Department here. In this blog, i created a VPC with both Public and Private Subnets.
VPC
It is a virtual network that is devoted to your AWS account. It enables you to launch AWS resources into a specified virtual network. You have complete control over your virtual networking environment, including the ability to choose your own IP address range, create subnets, and set up route tables and network gateways.
Pubic Subnet
It is a Virtual Private Cloud (VPC) subnetwork that has direct access to the Internet through a VPC-attached Internet Gateway. A public subnet gives instances public IP addresses so they can communicate with the Internet directly.
Private Subnet
It is a virtual private cloud (VPC) subnetwork that lacks direct connection to the Internet. A private subnet's instances are given private IP addresses, and they can only connect to the Internet using a network address translation (NAT) device or a proxy server that is situated in a public subnet.
Demo
In the Concole search for VPC
If you click on your VPC, there is an default VPC available
Now clicking on create VPC
Before we could only create only VPC but now along with creating VPC you can also create subnets, route tables and many more.
Now give the name of the project, the CIDR will be used by private IP address in the VPC making some changes from the default to avoid overlap
Select the number of availability zones, i am choosing 2 here
Can also customize the availability zone
Can also customize the CIDR of subnets
Public subnets have access to internet gateway
Private subnets only allow inter network traffic and also access to VPC end point of S3
Click on create VPC
If we would do it manually we should have done the entire below process and it would have consumed a lot of time but thankfully the above method makes it easy
Checking the subnets
The public and private subnets have been successfully created
Now creating a EC2 instance with public subnet created above
Launching the instance
Checking the instance and it is successfully created in the public subnet
Conclusion
Hope with this you get an idea of creating a VPC with public and private subnets. Thank you for seeing the blog till th end