Skip to content

Allow EC2 Elastic IP association with a network interface - #2193

Open
ishu7w wants to merge 1 commit into
apache:trunkfrom
ishu7w:add-ec2-elastic-ip-network-interface
Open

ishu7w wants to merge 1 commit into
apache:trunkfrom
ishu7w:add-ec2-elastic-ip-network-interface

Conversation

@ishu7w

@ishu7w ishu7w commented Oct 11, 2026

Copy link
Copy Markdown

Description

Fixes #1799. EC2 instances with multiple network interfaces cannot use the current Elastic IP association method: it always sends InstanceId, while AWS requires NetworkInterfaceId for that case.

Add an optional network_interface parameter accepting the existing EC2NetworkInterface type. When supplied, send its ID instead of InstanceId; existing calls retain their request parameters. Forward the option through the deprecated alias and document its use with VPC addresses.

AWS contract: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_AssociateAddress.html

Validation

  • The new regression fails on unchanged trunk because the interface option is unsupported.
  • All 1,211 EC2 tests pass. Request assertions verify interface targeting, absence of InstanceId, allocation ID use, legacy instance targeting, and alias forwarding.
  • Compute test suite: 5,920 passed, 5 skipped, 3 subtests passed; libvirt test module excluded because its native dependency is unavailable.
  • Black, isort, whitespace, and ASF license checks pass. Flake8 reports only the unchanged, pre-existing unused typing.List import in ec2.py (also verified against trunk).
  • AWS requests are fixture-tested; no live cloud resources were created.

Status

Ready for review.

Checklist

  • Code formatting and import sorting
  • Documentation
  • Tests
  • ICLA (if maintainers consider this extension a bigger change)

AI assistance: This implementation, regression tests, and description were prepared with OpenAI Codex.

Use NetworkInterfaceId instead of InstanceId when an interface is supplied, enabling association on instances with multiple interfaces. Preserve existing instance targeting and forward the option through the deprecated alias.

Fixes apache#1799
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.

AWS requires Interface to be specified when using elasticIP

1 participant