# EC2 - Delete on termination

**URL:** <https://forum.ansible.com/t/ec2-delete-on-termination/16668>\
**Category:** Ansible Project\
**Created:** [November 3, 2014, 9:55am UTC](https://forum.ansible.com/t/ec2-delete-on-termination/16668 "2014-11-03T09:55:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Carlos\_V](https://avatars.discourse-cdn.com/v4/letter/c/838e76/32.png) [@Carlos\_V](https://forum.ansible.com/u/Carlos_V)\
**Post date:** [November 3, 2014, 9:55am UTC](https://forum.ansible.com/t/ec2-delete-on-termination/16668/1 "2014-11-03T09:55:11Z")

</div>

Hello all,  
I’ve been experimenting with the Ansible ec2 modules and I’m looking for a way to set the default volume created to have the “delete on termination” option set.

I found these volume options:

`  
volumes:

- device\_name: /dev/sda1  
volume\_size: 512  
delete\_on\_termination: true  
`

but this seems to create a secondary volume and only that one is set to delete on termination. How can I do the same thing for the volume created with the instance? I don’t want a secondary volume in this case.

Any help is appreciated, thanks!

---

<div class="post-metadata">

**Author:** ![Carlos\_V](https://avatars.discourse-cdn.com/v4/letter/c/838e76/32.png) [@Carlos\_V](https://forum.ansible.com/u/Carlos_V)\
**Post date:** [November 5, 2014, 11:31pm UTC](https://forum.ansible.com/t/ec2-delete-on-termination/16668/2 "2014-11-05T23:31:26Z")

</div>

I actually found that by specifying the volume as /dev/sda instead of /dev/sda1, it enables the “delete\_on\_termination” flag for the primary volume.

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [November 7, 2014, 3:47pm UTC](https://forum.ansible.com/t/ec2-delete-on-termination/16668/3 "2014-11-07T15:47:26Z")

</div>

Hi Carlos,

We actually had someone bring this up in IRC the other day (perhaps it was you?), asking if they could pursue adding the option to delete the volumes as a specific parameter for the module too, so be on the lookout for that. Beyond that, if you continue seeing any problems with this, please let us know.

Thanks!

---

<div class="post-metadata">

**Author:** ![Carlos\_V](https://avatars.discourse-cdn.com/v4/letter/c/838e76/32.png) [@Carlos\_V](https://forum.ansible.com/u/Carlos_V)\
**Post date:** [November 7, 2014, 6:41pm UTC](https://forum.ansible.com/t/ec2-delete-on-termination/16668/4 "2014-11-07T18:41:33Z")

</div>

Hi James,  
thanks for your reply. That actually was me!

I might still pursue adding the option as my first contribution as I’m trying to learn more about developing Ansible modules.
