Prerequisite

  1. Review variables.tf and modify any Terraform variables as necessary.
  2. Setup AWS credentials file as per https://blogs.aws.amazon.com/security/post/Tx3D6U6WSFGOK2H/A-New-and-Standardized-Way-to-Manage-Credentials-in-the-AWS-SDKs. As an example:
$ cat ~/.aws/credentials
[default]
aws_access_key_id = <access key here>
aws_secret_access_key =  <secret key here>

To provision

  • Run terraform first to launch the necessary AWS resources
terraform apply
  • Run ansible
ANSIBLE_SSH_PIPELINING=1 ansible-playbook -i hosts flask.yml

To test

curl http://<ip address>

Where IP address is the one in the hosts file generated by terraform after launching the necessary instance and EIP.