What Is Vpc Public Subnet
When you create a subnet in aws vpc there is an option auto assign public ipv4 this is the main problem which makes confusion to the people if it is set to yes then your subnet is public no matter what name or key value you tagged to the subnet which means at the time of subnet creation if you use a name like private subnet a so it doesn t mean its private subnet it depends on your use case and configurations auto assign public ip option.
What is vpc public subnet. Instances in public subnet will have internet access while instances in private subnet don t. Within aws a public subnet is one that has a route table entry that directs traffic destined for 0 0 0 0 0 to an internet gateway. A public subnet has an outbound route that sends all traffic through what aws calls an internet gateway igw.
A public subnet is a subnet that s associated with a route table that has a route to an internet gateway. Tasks and services in the private subnets can access the internet through a nat gateway. This provides 256 private ipv4 addresses.
In the left pane click internet gateways choose create internet gateway. While designing your cloud infrastructure using amazon vpc it is best practice to place your applications such as webserver in public subnet and database in private subnet. Firstly you need to create and attach an internet gateway to your vpc.
Give a name for the igw and click create. Now to treat the subnet as public we have to create an internet gateway. In this diagram subnet 1 is a public subnet.
So what makes a subnet public. By default if you create an igw it wont be attached with any vpc so you should see the state as detached. A subnet that s associated with a route table that has a route to an internet gateway is known as a public subnet.
If a subnet s traffic is routed to an internet gateway the subnet is known as a public subnet. An internet gateway enables communication over the internet and a virtual private network vpn connection enables communication with your corporate network. The igw lets traffic ipv4 or ipv6 out of the vpc without any constraints on bandwidth.