可以在 VPC 中的 AWS 上创建的最小子网是多少?

What is the smallest subnet one can create on AWS in the VPC?

我想将子网中可以 运行 的实例数限制为尽可能少的实例数。这与 IAM 角色相结合将允许我限制用户可以在我的 AWS 账户上创建的实例数量(请参阅反映我动机的 https://forums.aws.amazon.com/thread.jspa?threadID=174503 要求 #4)。

可以在 VPC 中的 AWS 上创建的最小子网是多少?IPv4 CIDR 是多少?

16 个 IP 是 VPC 子网的最小范围 -- /28 网络掩码。

例如,您可以创建一个 CIDR 范围为 10.0.0.0/26 的 VPC,它最多支持 10.0.0.0 - 10.0.0.63.

范围内的 64 个 IP

然后您可以使用以下 VPC CIDR 范围创建 4 个子网,每个子网有 16 个可用 IP:

10.0.0.0/28   (10.0.0.0  - 10.0.0.15)
10.0.0.16/28  (10.0.0.16 - 10.0.0.31)
10.0.0.32/28  (10.0.0.32 - 10.0.0.47)
10.0.0.48/28  (10.0.0.48 - 10.0.0.63)

注意: 请参阅@sqlbot 下面的重要评论。并非所有范围内的 16 个都可以用于实例。

20191214:AWS 提供 /29 CIDR 并允许每 https://aws.amazon.com/directconnect/faqs/

/31

引用如下:

Q: In the case of public virtual interface, I will need /29 public IPv4 addresses. Will AWS provide me with /29 public IPv4 Classless Inter-Domain Routing (CIDR)?

Yes, upon request, AWS will provide you with /29 public IPv4 CIDR block addresses.

Q: Do I have to use /29 or can I use two /31 for my logical redundancy sessions?

For simplified routing, it's recommended to use the default /29 addresses for a single virtual interface. If there is a requirement for your network to have multiple /31 addresses you can create two separate /31 addresses for a single VIF. BGP peering on these two /31 addresses will terminate on multiple AWS devices for high availability.

AWS 中允许的最小 CIDR 块是 /31

但是,由于最初的问题是关于 VPC 子网的,这是另一回事,因为 AWS 为每个子网保留了一些 IP。

根据此处的 AWS VPC 常见问题文档:https://aws.amazon.com/vpc/faqs/

Q. Is there a limit on how large or small a subnet can be?

The minimum size of a subnet is a /28 (or 14 IP addresses.) for IPv4. Subnets cannot be larger than the VPC in which they are created.

For IPv6, the subnet size is fixed to be a /64. Only one IPv6 CIDR block can be allocated to a subnet.

Q. Can I use all the IP addresses that I assign to a subnet?

No. Amazon reserves the first four (4) IP addresses and the last one (1) IP address of every subnet for IP networking purposes.

因此,对于 IPv4,答案是 /28。