N
The Daily Insight

What is difference between private and public subnet?

Author

Ava Arnold

Updated on March 15, 2026

The instances in the public subnet can send outbound traffic directly to the internet, whereas the instances in the private subnet can't. Instead, the instances in the private subnet can access the internet by using a network address translation

network address translation

Network address translation (NAT) is a method of mapping an IP address space into another by modifying network address information in the IP header of packets while they are in transit across a traffic routing device.

› wiki › Network_address_translation

(NAT) gateway that resides in the public subnet.

What is the difference between a public and private subnet in AWS?

Public subnets have a default route to an Internet Gateway; private subnets do not. So, to determine if a given subnet is public or private, you need to describe the route table that is associated with that subnet. That will tell you the routes and you can test for a 0.0.

How do you connect public subnet to private subnet?

Nat Gateway: A Nat Gateway enables instances in private subnets to connect to the internet. The Nat gateway must be deployed in the public subnet with an Elastic IP. Once the resource is created, a route table associated with the the private subnet needs to point internet-bound traffic to the NAT gateway.

What is difference between VPC and subnet?

Subnet is a key component in VPC. A VPC can contain all public subnets (or) public/private subnet combination. Private Subnet is a subnet which doesn't have a route to the internet gateway. A subnet can be configured as a VPN-only subnet by routing traffic via virtual private gateway.

Why do we need private subnet?

The machines on a private subnet can access the Internet because the default route on a private subnet is not the VPC "Internet Gateway" object -- it is an EC2 instance configured as a NAT instance. A NAT instance is an instance on a public subnet with a public IP, and specific configuration.

What is the difference between aws public subnet and private subnet? | AWS Subnet|Amazon Web Service

Is 192.168 private or public?

And don't be surprised if you have a device or two at home with a so-called 192 IP address, or a private IP address beginning with 192.168. This is the most common default private IP address format assigned to network routers around the globe.

What is public subnet?

A public subnet is a subnet that's associated with a route table that has a route to an internet gateway. A private subnet with a size /24 IPv4 CIDR block (example: 10.0. 1.0/24). This provides 256 private IPv4 addresses. An internet gateway.

What is NAT gateway?

NAT Gateway is a highly available AWS managed service that makes it easy to connect to the Internet from instances within a private subnet in an Amazon Virtual Private Cloud (Amazon VPC). Previously, you needed to launch a NAT instance to enable NAT for instances in a private subnet.

What is the difference between VPN and VPC?

A VPC is a private network on the cloud. Multiple VPCs can be created in the same region but are isolated from each other. A VPC can be divided into multiple subnets. A VPN gateway is created based on a VPC and is the access point of a VPN connection.

What is a CIDR block?

CIDR blocks are groups of addresses that share the same prefix and contain the same number of bits. The combination of multiple connecting CIDR blocks into a larger whole, sharing a common network prefix, is what constitutes supernetting. The size of CIDR blocks can be determined by the length of the prefix.

What is a private subnet?

If a subnet is associated with a route table that does not have a route to an internet gateway, it's known as a private subnet. The IGW allows network traffic from the internet to reach endpoints inside the subnet.

Can an instance in a private subnet have a public IP?

Instances in a private subnet do not have public IP addresses. In summary: if a subnet has an IGW it is a public subnet. If a subnet has a NAT it is a private subnet.

Why is VPC created?

Amazon VPC enables you to build a virtual network in the AWS cloud - no VPNs, hardware, or physical datacenters required. You can define your own network space, and control how your network and the Amazon EC2 resources inside your network are exposed to the Internet.

What is difference between NAT gateway and Internet gateway?

A NAT device forwards traffic from the instances in the private subnet to the internet or other AWS services, and then sends the response back to the instances while Internet Gateway is used to allow resources in your VPC to access internet.

What is the difference between NAT instance and NAT gateway?

When a connection times out, a NAT gateway returns an RST packet to any resources behind the NAT gateway that attempt to continue the connection (it does not send a FIN packet). When a connection times out, a NAT instance sends a FIN packet to resources behind the NAT instance to close the connection.

What is difference between VPS and VPC?

A VPS is a VM with dedicated resources organizations can use as a server. A VPC is a private cloud environment that spans multiple servers and provides more flexibility and scalability to meet specific needs.

What VPC means?

virtual private cloud (VPC)

Which type of VPN is used by AWS?

AWS Client VPN uses the secure TLS VPN tunnel protocol to encrypt the traffic. A single VPN tunnel terminates at each Client VPN endpoint and provides users access to all AWS and on-premises resources.

What is the meaning of 0.0 0.0 0?

0.0 is used with a network mask of 0 to depict the default route as a destination subnet. This destination is expressed as 0.0. 0.0/0 in CIDR notation. It matches all addresses in the IPv4 address space and is present on most hosts, directed towards a local router.

What is VPC endpoint?

A VPC endpoint is a virtual device which is horizontally scaled, redundant and highly available, that provides communication between EC2 instances within your Virtual Private Cloud and other supported AWS services without introducing availability risks or bandwidth constraints on your network traffic.

What is VPC peering?

VPC Network Peering enables you to connect VPC networks so that workloads in different VPC networks can communicate internally. Traffic stays within Google's network and doesn't traverse the public internet. VPC Network Peering is useful in these environments: SaaS (Software-as-a-Service) ecosystems in Google Cloud.

How do I create a private subnet?

Create a private subnet

  1. In the navigation pane, choose Subnets. Then choose Create Subnet.
  2. In the Create Subnet dialog box, do the following: For Name tag, type an identifiable name such as CloudHSM private subnet . ...
  3. Repeat steps 2 and 3 to create subnets for each remaining Availability Zone in the region.

What is a subnet example?

Subnet masks are also expressed in dot-decimal notation like an IP address. For example, the prefix 198.51. 100.0/24 would have the subnet mask 255.255. 255.0.