Monthly Archives: May 2016

Autoscaling with AWS instances using Ansible-Pull

Ansible has an excellent feature called ansible-pull, which many people don’t know or don’t use. This feature works best for self healing infrastructure, best example is AWS Autoscaling in which new ec2 instance is created from vanilla ami, then pull the code from somewhere (version control system) and configure itself before announcing that it is ready to serve (mean add to the serving ELB).

The steps for ansible-pull are:

1. Pull the git repo containing your playbooks.
2. That repo is cloned to the mentioned directory.
3. ansible-pull starts executing the local.yml found in your cloned repo directory.

Let’s assume that you want to pull the code from the private git repo and for this you need the ssh private key but you have taken the updated vanilla ubuntu ami from the Marketplace, then how you will clone this private repo?¬†For this we’ll use the Bootstrap Pattern:

– Put the private part of ssh key for the git repository on S3.
– Getting ssh key from s3 bucket using IAM role credentials

For this, create a S3 bucket(in my case it is named “tendo-github-key-s3“):


Read more of this post

%d bloggers like this: