Repository navigation
Lets EC2 choose the build AZ by default - #852
Merged
lorengordon merged 1 commit intoNov 18, 2026
Merged
Conversation
Setting associate_public_ip_address without a subnet_id makes the amazon plugin infer a subnet in the default VPC, always choosing the subnet with the most free IPs. That pins every build to one AZ, so an InsufficientInstanceCapacity error in that AZ fails every build, and the retries keep trying the same AZ. Exposes the setting as aws_associate_public_ip_address, defaulting to null. When null, Packer launches without a subnet and EC2 places the instance in an AZ with capacity, using the default subnet's MapPublicIpOnLaunch to assign the public IP. Environments that must disable (or force) public IPs can still set the variable explicitly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lorengordon
force-pushed
the
fix/aws-associate-public-ip-var
branch
from
November 17, 2026 23:34
9051201 to
823c4b7
Compare
lorengordon
marked this pull request as ready for review
November 17, 2026 23:34
Contributor
|
This pull request is merged. |
eemperor
approved these changes
Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
November's scheduled GovCloud builds failed with
InsufficientInstanceCapacityfor t3.2xlarge in us-gov-west-1a, even though the template never sets an AZ (example: https://github.com/plus3it/spel/actions/runs/44174033910/job/134360520763). Every failed job launched into the same subnet in that AZ.Cause: we set
associate_public_ip_address = truewithout asubnet_id. In that case the amazon plugin (v1.8.4,common/step_network_info.go,GetDefaultVPCAndSubnet) picks a subnet in the default VPC itself, always the one with the most free IPs. That subnet pins the AZ, so all builds go to one AZ, andmax_retriesjust retries that same AZ.Changes offered/proposed in this pull request:
aws_associate_public_ip_address(bool, defaultnull) and uses it forassociate_public_ip_addressin theamazon-ebssurrogatesource. Whennull, Packer launches with no subnet and EC2 picks an AZ with capacity. The public IP comes from the default subnet'sMapPublicIpOnLaunch, which is enabled in the commercial and GovCloud build accounts.amazon-ebsvalidation template undertests/, which also hard-codedtrue.spel/README.md.Environments that must disable public IPs can set
PKR_VAR_aws_associate_public_ip_address=false, typically together withaws_subnet_id.Checked:
packer fmt -checkandpacker validatepass for the AWS builds with the variable unset,false, andtrue.🤖 Generated with Claude Code