Skip to content

Fix ec2 run-instances not validating --no-associate-public-ip-address against --network-interfaces - #10559

Open
Adityaj0 wants to merge 1 commit into
aws:v2from
Adityaj0:fix/ec2-run-instances-no-associate-public-ip
Open

Fix ec2 run-instances not validating --no-associate-public-ip-address against --network-interfaces#10559
Adityaj0 wants to merge 1 commit into
aws:v2from
Adityaj0:fix/ec2-run-instances-no-associate-public-ip

Conversation

@Adityaj0

Copy link
Copy Markdown

Summary

Fixes #10558.

--no-associate-public-ip-address and --associate-public-ip-address are two independent argparse destinations (no_associate_public_ip_address / associate_public_ip_address) — they only share a group_name for help-text grouping, not a dest. _check_args() in awscli/customizations/ec2/runinstances.py only ever checked associate_public_ip_address when validating that --network-interfaces isn't mixed with the scalar options, so --no-associate-public-ip-address silently bypassed the check and overwrote AssociatePublicIpAddress inside the user's own --network-interfaces JSON instead of raising the documented ParamValidationError.

This adds the missing check for no_associate_public_ip_address is False (its "flag was explicitly passed" state, since it's a store_false action defaulting to True).

Test plan

  • Added test_network_interfaces_with_no_associate_public_ip_address_errors (regression test for the bug) and test_network_interfaces_with_associate_public_ip_address_errors (locks in existing correct behavior) to tests/functional/ec2/test_run_instances.py
  • python -m pytest tests/functional/ec2/ tests/unit/customizations/ec2/ — 108 passed
  • Added changelog entry under .changes/next-release/

… against --network-interfaces

--no-associate-public-ip-address is a separate argparse dest
(no_associate_public_ip_address) from --associate-public-ip-address, so
the existing mutual-exclusivity check against --network-interfaces never
inspected it. This let the flag silently overwrite
AssociatePublicIpAddress inside the user's own --network-interfaces JSON
instead of raising the documented ParamValidationError.
@Adityaj0
Adityaj0 requested a review from a team as a code owner August 14, 2026 03:25
@Adityaj0

Copy link
Copy Markdown
Author

Fixes #10558

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant