A subnet is a network segment that falls within the CIDR block of the VPC. For example, if your VPC CIDR block is 10.0.0.0/16, you could have subnets configured as follows:
- 10.0.1.0/24
- 10.0.2.0/24
- 10.0.3.0/24
From a TCP/IP perspective, this would give you 256 addresses in each subnet. However, the first address is the network address and the last address is the broadcast address and so they are not available as host addresses. In addition to this, AWS reserves the first three host addresses in any subnet. The first available host address is reserved for internal AWS VPC routing, the second address is then reserved for AWS DNS, and the third address is reserved for future use.
This means that a /16 subnet would produce 251 available host addresses to use for your resources within that subnet. In our example, this would be as follows:
- 10.0.1.0 – Network address
- 10.0.1.1 – Reserved for AWS routing
- 10.0.1.2 – Reserved for AWS DNS
- 10.0.1.3Â ...