Automation in the cloud

A few months ago, I shared some Ansible Playbooks on my GitHub repository that could be used to automate the provisioning of a LAMP stack in AWS. I had a post-commit hook setup on one of the repository branches that would kick off a Jenkins build using the Ansible playbook. The playbook had tasks to create and bootstrap EC2 Instance web servers and the backend databases. In the world of Devops, there are a lot of tools typically used for Continuous Integration (CI) and Continuous Delivery (CD), such as Docker, Jenkins, Terraform, and Ansible to name a few.

While the Ansible playbooks were sufficient in provisioning the stacks, I wanted to have versions of the infrastructure as I made minor changes and I wanted to be able to create and delete all the items in any given build as a whole. The ideal solution for that was creating a CloudFormation Template that I could modify and use to build, replicate, and delete entire environments in a single command.

You can find a copy of my ansible playbook and the CloudFormation template in my github repository : here

Note: To run some of the modules in the playbooks, you'll need to have the most recent version of Ansible - version 2.4.

Capture1.PNG

Under the CloudFormation Page, you should see the stack being built and the parameters passed.

Capture2.PNG

Once the stack is completely built, under the Outputs page, the load balancer internet-facing URL will be available.

When you go to the URL, you should see the metadata information about the EC2 instance and database.

Capture5.PNG

If you refresh(a couple of times), you should see the EC2 server id change - as it sends traffic to different instances.

Capture6.PNG

 

*Cover Images from Electric-Cloud.com