Secure Deployment on AWS EC2 Clusters Across 10+ instances with Ansible and AWS CodeCommit

Gabriel Varaljay
2 min readOct 18, 2023

--

Project Description

In this project, grounded in an actual business use case, I utilised Ansible for the configuration management and deployment of the trailblazing HumanGov SaaS application across Amazon Web Services (AWS) EC2 instances. These instances are earmarked to serve multiple departments, precisely over ten distinct silo divisions.

The Power of Terraform

Automation tools like Terraform prove invaluable in large-scale deployment scenarios. Considering the daunting task of manually executing similar operations for over ten silos, it becomes abundantly clear why Terraform is a cornerstone in this project. Undertaking such a feat manually would be tedious and introduce a high margin for human error. Terraform streamlined the process, offering a stable and reliable way to manage infrastructure.

The Role of Ansible

Ansible emerged as a fundamental tool for automating configuration tasks, establishing directory structure, file manipulations, and deploying web applications in this context. As for the cloud services provider, AWS was the platform of choice. I leveraged various features like Inventory, Playbooks, Variables, Conditionals, Loops, and Roles in the Ansible ecosystem to achieve desired outcomes.

Ansible Inventory

The inventory functionality of Ansible facilitated the categorisation of AWS EC2 instances by silos, allowing for more targeted operations. This proved especially helpful in deploying configurations and changes to specific geographic regions.

Playbooks, Variables, Conditionals, Loops, and Roles

Ansible Playbooks were utilised to outline the automation tasks, making the process easily repeatable. Variables provided a way to make configurations easily customisable, and conditionals enabled task execution based on specific criteria. Loops came in handy for performing repeated tasks, and Roles provided a framework for bundling automation tasks into logical units.

Version Control Through AWS CodeCommit

While Git served as the underlying version control system, AWS CodeCommit was the repository used to store configuration files securely, per the client’s request. This centralised repository ensured the configuration data was kept secure and easily accessible for future deployments and audits.

Conclusion

The combination of Ansible for configuration management and Terraform for infrastructure provisioning, all hosted securely on AWS, made for an efficient, secure, and scalable solution. This project is a testament to the efficacy of automation and cloud services to achieve robust, streamlined deployments.

--

--

Gabriel Varaljay

Multi-Cloud & DevOps | AWS | Microsoft Azure | Google Cloud | Oracle Cloud | Linux | Terraform | digital problem solver