# Terminate all instances in a ASG with ec2\_asg

**URL:** <https://forum.ansible.com/t/terminate-all-instances-in-a-asg-with-ec2-asg/17717>\
**Category:** Ansible Project\
**Created:** [March 11, 2015, 1:35pm UTC](https://forum.ansible.com/t/terminate-all-instances-in-a-asg-with-ec2-asg/17717 "2015-03-11T13:35:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julien\_Syx](https://avatars.discourse-cdn.com/v4/letter/j/258eb7/32.png) [@Julien\_Syx](https://forum.ansible.com/u/Julien_Syx)\
**Post date:** [March 11, 2015, 1:35pm UTC](https://forum.ansible.com/t/terminate-all-instances-in-a-asg-with-ec2-asg/17717/1 "2015-03-11T13:35:18Z")

</div>

Hello,

I’m trying to use the ec2\_asg module here : [http://docs.ansible.com/ec2\_asg\_module.html](http://docs.ansible.com/ec2_asg_module.html)  
The goal is to kill all instances during the night and boot them the morning.

I tried :

- name: Shutdown PREPROD  
hosts: localhost  
remote\_user: root

tasks:

- name: Shutdown instances  
ec2\_asg:  
region: eu-west-1  
name: MYASGNAME  
min\_size: 1  
max\_size: 5  
desired\_capacity: 2

Settings are ok, the playbook run an modify my ASG as I wish.

When I try to set desired\_capacity at 0 or min\_size at 0, my parameters are ignored and no action is done.  
Any idea about why I can’t do this ? The delete function do the same thing before remove the ASG.

My version of ansible is 1.8.1, installed with “pip”.

Thanks

---

<div class="post-metadata">

**Author:** ![Julien\_Syx](https://avatars.discourse-cdn.com/v4/letter/j/258eb7/32.png) [@Julien\_Syx](https://forum.ansible.com/u/Julien_Syx)\
**Post date:** [March 12, 2015, 3:57pm UTC](https://forum.ansible.com/t/terminate-all-instances-in-a-asg-with-ec2-asg/17717/2 "2015-03-12T15:57:53Z")

</div>

An issue has been filled here : [https://github.com/ansible/ansible-modules-core/issues/931](https://github.com/ansible/ansible-modules-core/issues/931)
