AWS EC2 Instance and Container setup with Ansible (Part 7) AWS EC2 Instance and Container setup with Ansible (Part 7)

December 6, 2021

ansible aws debian devops

I started with this tutorial https://www.agix.com.au/build-an-ec2-using-ansible-step-by-step/

The ansible code is in Part 7 of the repo github.com/allotmentandy/aws, this code creates a NEW instance on EC2.

To run the playbook:

ansible-playbook  -i ./hosts --private-key ~/.ssh/private.pem createEC2.yml

Improvements for the next version:

  • this uses the deprecated https://docs.ansible.com/ansible/latest/collections/amazon/aws/ec2_module.html#ansible-collections-amazon-aws-ec2-module
  • check if there is an instance first
  • destroy the instance script
  • add the Elastic IP address

If you would like to contact me with this form on londinium.com, ilminster.net or via Twitter @andylondon