Select Page



If you want to use ansible for AWS EC2 instances you need to make these steps to make it working:

  1. On your local machine:
    • install python-boto library:
      sudo apt-get install python-boto
    • it will create also a file ~/.boto
    • add AWS credential into this file into section [Credentials]:
      aws_access_key_id = xxxxxxxxxxxxxxxxxxxxxx
      aws_secret_access_key = XXXXXXXXXXXXXXXXXX
  2. When you create new instance on EC2 you have to manually install python there – otherwise ansible will fail.
    • connect to the instance via ssh
    • install pytnon:
      sudo apt-get install python
  3. Remember – if you created new instance with Ubuntu your default user you will be able to connect to will be user “ubuntu”. Therefore you need to set in hosts file: ansible_connection=ssh ansible_user=ubuntu
  4. Now you can use your already existing ansible playbooks