I am new to Ansible, with some experience in Chef. I am considering learn and use Ansible to manage environments.

I was wondering, what would be the best practice to manage inventory of AWS spot instances?

For example, when a spot instance is shut down the old IP is not relevant anymore in the inventory of hosts.

Are there any other alternative approaches for the use case of elastic environments?

1 Answer 1


You are looking for Dynamic Inventory

Please look into ec2.py and ec2.ini of Ansible, and also the Dynamic Inventory docs of Ansible are very good for understanding how to manage your AWS inventory.

  • thank you, so for example if I give to some instances specific tag, I could access the dynamic inventory file and take the instances under specific tag ? is it best practice?
    – Berlin
    Commented Mar 2, 2017 at 13:28
  • 1
    @Berlin Yeah, why not. The tag is called a host group :)
    – Dawny33
    Commented Mar 2, 2017 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.