A highly available, containerized microservice deployment engineered with Terraform, Docker, and AWS ECS. This project implements a Multi-AZ strategy to ensure fault tolerance and automated scalability.
The infrastructure is designed for 99.9% availability, utilizing two Availability Zones (AZs) within a custom VPC.
- Networking: Custom VPC with Public/Private subnets across 2 AZs.
- Compute: AWS ECS (Elastic Container Service) running on EC2 instances.
- Scaling: Auto Scaling Group (ASG) utilizing AWS Launch Templates for dynamic instance provisioning.
- Traffic Management: Application Load Balancer (ALB) acting as the ingress point, routing traffic to Nginx-backed service containers.
- Security: Principle of Least Privilege (PoLP) enforced via AWS IAM Roles and granular Security Groups.
- Application: A Python-based microservice orchestrated with Docker and served via Nginx.
| Category | Technology |
|---|---|
| Cloud Provider | AWS (VPC, IAM, ASG, ALB) |
| Infrastructure | Terraform (IaC) |
| Orchestration | AWS ECS |
| Containerization | Docker |
| Web Server | Nginx |
| Language | Python |
The infrastructure is spread across two distinct Availability Zones. If one AWS data center experiences an outage, the Application Load Balancer automatically reroutes traffic to the healthy nodes in the second AZ.
The entire environment is version-controlled and reproducible.
- Modular Design: Clean separation of networking, security, and compute modules.
- State Management: Remote state storage via S3.
Using AWS Launch Templates and Auto Scaling Policies, the cluster scales based on CPU/Memory utilization, ensuring cost-efficiency during low traffic and stability during spikes.
- Docker: Images are optimized for size and security.
- ECS: Manages the lifecycle of the Python containers, performing health checks and rolling updates.
docker build -t microservice-app ./app
cd terraform
terraform init
terraform plan
terraform apply -auto-approve
Once Terraform completes, it will output the ALB_DNS_Link. Copy this into your browser to view the running application.
- IAM Roles: Task Execution Roles allow ECS to pull images from ECR without hardcoded credentials.
- Private Isolation: The Python application resides in a private subnet, shielded from the public internet and accessible only via the Load Balancer.
Maintained by Archibong Hashbury Looking to solve complex infrastructure challenges.