If we are working on a new deployment, then we need to perform the following tasks:
- Find the latest CentOS 7 AMI in the region we are using
- Upload a copy of our public key so that we can use it to SSH into the instance
- Launch an instance using the previous information
- Add the new instance to a host group
- Wait until SSH is available
- Add our instance to the Elastic Load Balancer
All of these tasks are defined in roles/ec2/tasks/new_deployment.yml, so let's start working on these tasks by looking at how we can find the correct AMI to use.
We can't simply supply an AMI ID here as each region has a different ID, and also each AMI is regularly updated to make sure it is patched. To get around this, we can run the following tasks: ...