Skip to content

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

Merged
micafer merged 2 commits into
apache:trunkfrom
ishu7w:add-ec2-elastic-ip-network-interface
Nov 5, 2026
Merged

micafer merged 2 commits into
apache:trunkfrom
ishu7w:add-ec2-elastic-ip-network-interface

Conversation

@ishu7w

@ishu7w ishu7w commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

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
@ishu7w

ishu7w commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Gentle follow-up on this PR from October 11. GitHub currently reports no checks and there has not been review feedback yet. Could a maintainer let me know whether CI should be run or if any changes are needed?

@micafer micafer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@micafer
micafer enabled auto-merge November 5, 2026 09:36
@micafer
micafer merged commit 512d57d into apache:trunk Nov 5, 2026
16 of 17 checks passed
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.62%. Comparing base (bd9cbb3) to head (9c2d51c).
⚠️ Report is 9 commits behind head on trunk.

Additional details and impacted files
@@           Coverage Diff           @@
##            trunk    #2193   +/-   ##
=======================================
  Coverage   83.61%   83.62%           
=======================================
  Files         352      352           
  Lines       82045    82069   +24     
  Branches     8799     8800    +1     
=======================================
+ Hits        68601    68625   +24     
  Misses      10564    10564           
  Partials     2880     2880           
Files with missing lines Coverage Δ
libcloud/compute/drivers/ec2.py 75.05% <100.00%> (+0.05%) ⬆️
libcloud/test/compute/test_ec2.py 97.94% <100.00%> (+0.03%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AWS requires Interface to be specified when using elasticIP

3 participants