# how to attach extra private ips to an ec2 instance

**URL:** <https://forum.ansible.com/t/how-to-attach-extra-private-ips-to-an-ec2-instance/19842>\
**Category:** Ansible Project\
**Created:** [November 24, 2015, 3:26pm UTC](https://forum.ansible.com/t/how-to-attach-extra-private-ips-to-an-ec2-instance/19842 "2015-11-24T15:26:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kesten\_Broughton2](https://avatars.discourse-cdn.com/v4/letter/k/ecc23a/32.png) [@Kesten\_Broughton2](https://forum.ansible.com/u/Kesten_Broughton2)\
**Post date:** [November 24, 2015, 3:26pm UTC](https://forum.ansible.com/t/how-to-attach-extra-private-ips-to-an-ec2-instance/19842/1 "2015-11-24T15:26:46Z")

</div>

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](http://myid.id),secondary\_private\_ip\_address\_count=2,allow\_reassignment=True)
