# How to change the configuration of ec2\_group?

**URL:** <https://forum.ansible.com/t/how-to-change-the-configuration-of-ec2-group/18355>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [May 31, 2015, 4:09am UTC](https://forum.ansible.com/t/how-to-change-the-configuration-of-ec2-group/18355 "2015-05-31T04:09:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ming\_Hu](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@Ming\_Hu](https://forum.ansible.com/u/Ming_Hu)\
**Post date:** [May 31, 2015, 4:09am UTC](https://forum.ansible.com/t/how-to-change-the-configuration-of-ec2-group/18355/1 "2015-05-31T04:09:10Z")

</div>

Hi

I have a simple playbook which create a security group on AWS

`

- name: Create cc

hosts: localhost

tasks:

- name: Create security group

ec2\_group:

name: cc

description: Security group for cc

region: ap-northeast-1

state: absent

rules:

- proto: tcp

from\_port: 80

to\_port: 80

cidr\_ip: 0.0.0.0/0

- proto: tcp

from\_port: 22

to\_port: 22

cidr\_ip: 0.0.0.0/0  
`

How can I change the configuration of this security group?

It seems that I can only write another playbook to delete it first, then create another one with the same name.

And if this security group is used by another ec2 instance, I need to delete the instance too. This seems so un-friendly.

What’s the best practice here to change the configuration of one ec2-security group? I think this problem also happens on other ec2 related modules.
