Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adds support for assigning elastic IPs to Elastic Network Interfaces

  • Loading branch information...
commit f889821d92992feb42e707f374fe7ba132df9be7 1 parent bdddbbd
@nithint nithint authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 boto/ec2/
11 boto/ec2/
@@ -1212,7 +1212,7 @@ def allocate_address(self, domain=None):
return self.get_object('AllocateAddress', params, Address, verb='POST')
- def associate_address(self, instance_id, public_ip=None, allocation_id=None):
+ def associate_address(self, instance_id=None, public_ip=None, allocation_id=None, network_interface_id=None):
Associate an Elastic IP address with a currently running instance.
This requires one of ``public_ip`` or ``allocation_id`` depending
@@ -1227,10 +1227,17 @@ def associate_address(self, instance_id, public_ip=None, allocation_id=None):
:type allocation_id: string
:param allocation_id: The allocation ID for a VPC-based elastic IP.
+ :type network_interface_id: string
+ : param network_interface_id: The network interface ID to which elastic IP is to be assigned to
:rtype: bool
:return: True if successful
- params = { 'InstanceId' : instance_id }
+ params = {}
+ if instance_id is not None:
+ params['InstanceId'] = instance_id
+ elif network_interface_id is not None:
+ params['NetworkInterfaceId'] = network_interface_id
if public_ip is not None:
params['PublicIp'] = public_ip
Please sign in to comment.
Something went wrong with that request. Please try again.