Skip to content

Difficulty creating a /17 VPC with 3 AZs #1698

Description

@jkodroff

Describe what happened

Submitted on behalf of a Community Slack member:

This may not be a bug, per se, but it is a UX issue. When trying to use automatic subnet allocations across 3 AZs, you're basically forced to throw away 1/4 of your address space.

Example:

  1. Create a VPC with a /17 CIDR block (32,768 addresses)
  2. Create 3 /19 private subnets
  3. Create 3 /21 public subnets

This should fit evenly in a /17 with a bit of leftover space (basically a final /21). When attempting to do this, you receive an error:

error: awsx:ec2:Vpc resource 'shared-non-prod' has a problem: Subnets are too large for VPC. VPC has 8192 addresses, but subnets require 10240 addresses.

I think this is happening because network blocks don't divide easily by 3, so it's rounding up to 4 and dividing the address space that way (32,768/4 = 8192).

In AWS a 3-AZ network configuration is very common as this is the default minimum number of availability zones per region.

It'd be nice to use automatic subnet allocation, but not at the expense of throwing away 1/4 of the address space.

Sample program

n/a

Log output

CLI
Version 3.191.0
Go Version go1.25.0
Go Compiler gc

Plugins
KIND NAME VERSION
resource aws 7.7.0
resource awsx 3.0.0
resource docker 4.8.2
resource docker-build 0.0.13
language python 3.191.0

Host
OS darwin
Version 13.7.6
Arch arm64

This project is written in python: executable='/Users/Source/aws-platform-management-vpc/.venv/bin/python' version='3.13.3'

Dependencies:
NAME VERSION
-vpc 0.1.0

Affected Resource(s)

No response

Output of pulumi about

CLI
Version      3.191.0
Go Version   go1.25.0
Go Compiler  gc

Plugins
KIND      NAME          VERSION
resource  aws           7.7.0
resource  awsx          3.0.0
resource  docker        4.8.2
resource  docker-build  0.0.13
language  python        3.191.0

Host
OS       darwin
Version  13.7.6
Arch     arm64

This project is written in python: executable='/Users/Source/aws-platform-management-vpc/.venv/bin/python' version='3.13.3'

Dependencies:
NAME       VERSION
<corp>-vpc  0.1.0

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSome behavior is incorrect or out of spec

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions