# Creating an ec2 instance with custom secusity group and public ip

**URL:** <https://forum.ansible.com/t/creating-an-ec2-instance-with-custom-secusity-group-and-public-ip/20189>\
**Category:** Ansible Developer\
**Created:** [January 13, 2016, 4:49am UTC](https://forum.ansible.com/t/creating-an-ec2-instance-with-custom-secusity-group-and-public-ip/20189 "2016-01-13T04:49:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Danishka\_Navin](https://avatars.discourse-cdn.com/v4/letter/d/c0e974/32.png) [@Danishka\_Navin](https://forum.ansible.com/u/Danishka_Navin)\
**Post date:** [January 13, 2016, 4:49am UTC](https://forum.ansible.com/t/creating-an-ec2-instance-with-custom-secusity-group-and-public-ip/20189/1 "2016-01-13T04:49:40Z")

</div>

Hi,

I was trying to create an ec2 instance with custom secusity group and public ip.  
But when the instance create, only default security group attached but not custom security groups. And also there is no public IP at all.

Highly appreciate if can someone help me to fix this issue.

My config files:  
[https://paste.fedoraproject.org/310063/26591671/](https://paste.fedoraproject.org/310063/26591671/)  
[https://paste.fedoraproject.org/310064/65919214/](https://paste.fedoraproject.org/310064/65919214/)

Thanks

---

<div class="post-metadata">

**Author:** ![Rob\_White](https://avatars.discourse-cdn.com/v4/letter/r/71c47a/32.png) [@Rob\_White](https://forum.ansible.com/u/Rob_White)\
**Post date:** [February 1, 2016, 11:17am UTC](https://forum.ansible.com/t/creating-an-ec2-instance-with-custom-secusity-group-and-public-ip/20189/2 "2016-02-01T11:17:24Z")

</div>

You’re not passing a list of security group names to the ec2 module you’re passing a list of dicts.

For a public ip you need the ‘assign\_public\_ip’ parameter set to ‘yes’ in the ec2 module.
