Software as a Service | Benefits | Working | Use case | Future | Tips
What is Software as a Service ( SaaS )? Software as a Service (SaaS) is a type of…
An AWS subnet is a range of IP addresses carved out of a VPC’s CIDR block. Every subnet lives in exactly one Availability Zone, and that binding is set at creation and cannot be changed.
This is the answer to the most common question about them: you cannot move a subnet to a different Availability Zone. There is no API call, no console option and no workaround. The subnet’s AZ is part of its identity.
An Availability Zone is one or more physically separate data centres with independent power, cooling and networking. The subnet’s address range is announced within that zone’s physical network fabric. Moving it would mean re-announcing that range in a different facility while resources still hold addresses from it, which is not a configuration change but a physical routing change.
The design intent is also worth noting: because subnets are AZ-bound, you cannot accidentally build something that appears redundant but sits entirely in one facility. Spreading across zones requires spreading across subnets, deliberately.
If resources are in the wrong AZ, you create a new subnet in the target zone and migrate to it:
| Resource | Can it change subnet? | How to move it |
|---|---|---|
| EC2 instance | No | Create an AMI, launch in the new subnet |
| EBS volume | No, AZ-bound | Snapshot, then create a volume in the target AZ |
| RDS instance | Yes, indirectly | Modify the subnet group, or use a Multi-AZ failover |
| Elastic Network Interface | No | Create a new ENI in the target subnet |
| Load balancer | Yes | Edit its subnet mappings, no downtime |
| Auto Scaling group | Yes | Update the subnet list; new instances launch in the new zone |
| NAT Gateway | No | Create a new one in the target subnet |
AWS does not have a “public subnet” setting. The distinction is entirely determined by the route table:
| Public subnet | Private subnet | |
|---|---|---|
Default route (0.0.0.0/0) points to | Internet Gateway | NAT Gateway, or nothing |
| Inbound from the internet | Possible, with a public IP | No |
| Outbound to the internet | Direct | Via NAT, if configured |
| Typical contents | Load balancers, bastion hosts, NAT gateways | Application servers, databases |
A subnet whose route table sends 0.0.0.0/0 to an Internet Gateway is public. Change that route and the same subnet becomes private. Nothing else about the subnet changes.
Note that the NAT Gateway must sit in a public subnet while serving private ones. Placing it in the private subnet it is meant to serve is a common mistake and produces no internet access at all.
AWS reserves five addresses in every subnet, not the two you would expect from standard networking:
| Address | Reserved for |
|---|---|
.0 | Network address |
.1 | VPC router |
.2 | DNS (the Amazon-provided resolver) |
.3 | Reserved for future use |
.255 (last) | Broadcast address, reserved even though VPCs do not support broadcast |
So a /28 gives 11 usable addresses, not 14. On a /24 the loss is negligible; on small subnets it matters.
| CIDR | Total | Usable |
|---|---|---|
| /28 | 16 | 11 |
| /27 | 32 | 27 |
| /26 | 64 | 59 |
| /24 | 256 | 251 |
| /20 | 4,096 | 4,091 |
| /16 | 65,536 | 65,531 |
Allowed sizes are /28 (smallest) to /16 (largest). Subnets cannot be resized after creation either, plan with room to grow, and remember that EKS and ECS consume addresses far faster than instance counts suggest, because every pod or task takes an ENI address.
A layout that avoids most of the problems above:
VPC: 10.0.0.0/16
AZ-a: 10.0.0.0/24 public (ALB, NAT GW)
10.0.10.0/24 private (application)
10.0.20.0/24 private (database)
AZ-b: 10.0.1.0/24 public
10.0.11.0/24 private
10.0.21.0/24 private
AZ-c: 10.0.2.0/24 public
10.0.12.0/24 private
10.0.22.0/24 privateThree points about this:
| Security Group | Network ACL | |
|---|---|---|
| Applies to | An ENI / instance | The whole subnet |
| State | Stateful, return traffic allowed automatically | Stateless, return traffic needs its own rule |
| Rules | Allow only | Allow and deny |
| Evaluation | All rules considered | In numbered order, first match wins |
The stateless behaviour of NACLs is the thing that bites people. If you tighten a NACL and forget to permit the ephemeral port range (1024–65535) inbound, outbound connections open and their replies are dropped, connections hang rather than fail cleanly. Security Groups have no such problem, which is why most designs leave NACLs at their default and do the work in Security Groups. See stateful vs stateless firewalls for why this matters.
No. The AZ is fixed at creation. Create a new subnet in the target zone and migrate resources to it.
No. The CIDR block is immutable. You can add another CIDR block to the VPC and create new subnets from it, but an existing subnet cannot grow.
AWS reserves five per subnet, network, VPC router, DNS, one for future use, and the broadcast address.
Point its route table’s 0.0.0.0/0 route at an Internet Gateway. That is the only thing that distinguishes public from private.
No, one subnet, one AZ. High availability comes from creating subnets in several zones and spreading resources across them.
Not strictly, but you should. A single NAT Gateway is a single point of failure for every private subnet routing through it, and it generates cross-AZ data transfer charges for traffic from other zones.