CloudFormation-Based Infrastructure Deployment
Overview
The project focused on migrating a Laravel application and MySQL database from an on-premises environment to AWS, leveraging CloudFormation for fully automated infrastructure provisioning. The application played a crucial role in document verification for banks, streamlining and accelerating the loan processing workflow for financial institutions and loan providers, enhancing efficiency, accuracy, and operational speed.
Challenges
Neerja Software Private Limited faced multiple challenges with their on-premises infrastructure:
-
Complex Infrastructure Management: Their existing infrastructure was difficult to manage, leading to increased operational overhead and maintenance costs.
-
Manual Deployment Issues: Frequent deployment errors due to manual processes, causing delays in updates and inconsistencies between development and production environments.
-
Scalability Limitations: The on-premises setup could not scale dynamically based on traffic spikes, resulting in downtime and performance issues.
-
Lack of Standardization: No Infrastructure as Code (IaC) methodology was followed, making it difficult to replicate and scale environments efficiently.
-
Security and Compliance Concerns: The existing infrastructure lacked advanced security features such as network isolation, IAM role-based access control, and automated security group configurations.
Neerja Software Private Limited needed a fully automated, scalable, and standardized AWS infrastructure to streamline their deployment and scaling processes.
Proposed Solution
To overcome these challenges, Habilelabs proposed a CloudFormation-based Infrastructure as Code (IaC) solution, ensuring a fully automated and standardized deployment process. This solution leveraged three distinct CloudFormation templates, each serving a critical function.
The first template provisions the foundational AWS infrastructure, including the VPC, public and private subnets, route tables, and security groups, creating a secure and scalable network architecture. The second template established the ECS cluster with Fargate, defining task definitions, auto-scaling policies, and service configurations to efficiently manage containerized workloads. Finally, the third template automated the deployment pipeline by setting up AWS CodePipeline and integrating CodeBuild and CodeDeploy stages to enable seamless, hands-free application deployment directly from the source repository.
This structured approach eliminated manual efforts, enhanced security, and ensured consistency across environments, significantly improving deployment efficiency and operational scalability.

Infrastructure Setup Using CloudFormation
CloudFormation templates were created to automate the provisioning of AWS resources, ensuring consistency and repeatability. Three separate CloudFormation stacks were implemented:
Serverless VPC Setup Stack
- Created a dedicated VPC with two public subnets.
- Configured an Internet Gateway for public access.
- Established route tables and security groups for networking control.
- Deployed an Application Load Balancer (ALB) to manage traffic distribution.
Serverless Container Setup Stack
- Created an ECS cluster for managing containerized Laravel applications.
- Defined ECS task definitions for three services: Greenfinch-Legal, Greenfinch, and Greenfinch-Banker.
- Configured auto-scaling policies to adjust the number of running containers based on traffic load.
- Associated ECS services with the ALB target group for efficient request routing.
- Deployed applications as AWS Fargate tasks, eliminating the need for manual server management.
CodePipeline Build & Deploy Stack
- Set up AWS CodePipeline to automate CI/CD deployment.
- Configured CodeBuild to fetch source code, build Docker images, and push them to Amazon ECR.
- Implemented Git Sync with Bitbucket to pull the latest application code automatically.
- Defined auto-deployment to ECS services using CodeDeploy.
How CloudFormation Was Used and How It Was Helpful?
Infrastructure as Code (IaC) Implementation
- CloudFormation templates automated entire infrastructure creation and deployment, ensuring consistency across environments.
Modular and Reusable Stack Design
- The three-stack approach enabled separation of networking, application deployment, and CI/CD processes, improving maintainability.
Automation & Zero Manual Effort
- Infrastructure provisioning and updates were completely automated, eliminating manual errors and reducing deployment time.
Security and Compliance
- IAM roles and security groups were enforced programmatically, enhancing security.
- AWS WAF was implemented via CloudFormation to protect against threats such as SQL injection and XSS.
Scalability and Reliability
- Auto-scaling policies were defined to ensure that ECS tasks scaled dynamically based on demand, improving availability and performance.
Faster CI/CD with Git Integration
- Integrated AWS CodeStar Connections for Bitbucket to ensure automated builds and deployments without manual intervention.
Business Impact and ROI Improvements
The CloudFormation-driven AWS migration delivered measurable business benefits to Neerja Software Private Limited:
Reduced Operational Costs (-35%)
- Eliminated on-premises infrastructure costs, including hardware maintenance and manual management.
- Pay-as-you-go pricing for AWS resources optimized cloud expenses.
Faster Deployment Cycles (-70%)
- Automated CI/CD pipeline reduced application deployment time from hours to minutes.
- Eliminated manual deployment errors, improving overall system stability.
Improved Scalability (+50%)
- ECS Fargate auto-scaling ensured the application handled traffic surges efficiently.
- Enabled the client to support more users without additional infrastructure investment.
Increased Developer Productivity (+40%)
- CloudFormation and CodePipeline automation freed developers from infrastructure concerns.
- Allowed the team to focus on feature development rather than deployment overhead.
Enhanced Security and Compliance
- Automated security configurations ensured a harder infrastructure.
- WAF, IAM roles, and VPC isolation improved data protection and regulatory compliance.
Conclusion
Habilelabs successfully leveraged AWS CloudFormation to automate infrastructure deployment for Neerja Software Private Limited, ensuring a scalable, cost-effective, and secure environment. The migration from on-premises to AWS, powered by ECS Fargate, ALB, RDS MySQL, and CodePipeline, significantly improved operational efficiency and ROI.
