how to attach extra private ips to an ec2 instance

9 views
Skip to first unread message

Kesten Broughton

unread,
Nov 24, 2015, 10:26:51 AM11/24/15
to ansible...@googlegroups.com

I've looked at modules 
ec2         create an instance and attach it to an interface_id or add one private and or one public ip
ec2_eip  attach extra public ips
ec2_eni  attach extra ethernet interfaces

I'm trying to attach extra private ips (routable within a vpc) to a virtual eth0:1, eth0:2 to an ec2 host (running docker).   Is there any existing module that can do this?


Using boto i can
from import import ec2
c = ec2.connect_to_region(aws_region)
c.ec2.assign_private_ip_addresses(network_interface_id=myid.id,secondary_private_ip_address_count=2,allow_reassignment=True)

This is basically what I want to accomplish.  I believe if my instance is already attached to the appropriate subnet then I can do it from the instance side alone, but that assign_private_ip_addresses manages the pool so i don't accidentally attach the same ip to different instances.

Has anybody done this?  If not, would any of the above modules accept a PR for such?

kesten

Reply all
Reply to author
Forward
0 new messages