This repository contains a complete DevOps setup for deploying a SimpleTimeService on AWS using ECS and an Application Load Balancer.
It includes:
- Python web application that returns a pure JSON response with the following structure:
{
"timestamp": "<current date and time>",
"ip": "<IP address of the visitor>"
}- Dockerfile to build the container image
- Terraform code to provision AWS infrastructure using ECS and an Application Load Balancer (ALB)
- Language: Python
- Web Framework: Flask (simple HTTP service)
- Containerization: Docker
- Cloud Provider: AWS
- Container Orchestration: Amazon ECS
- Load Balancer: Application Load Balancer (ALB)
.
├── app/ # Application source code and Dockerfile
└── terraform/ # Terraform infrastructure code
Make sure you have the following installed:
- Git
- Docker
- Terraform
- AWS CLI
git clone https://github.com/288milan/devops-challenge.git
cd devops-challengecd app
docker buildx build -t <image_name>:<tag> .Replace
<image_name>and<tag>accordingly.
docker login
docker tag <image_name>:<tag> <dockerhub-username>/<repository-name>:<tag>
docker push <dockerhub-username>/<repository-name>:<tag>docker run -d -p 8080:8080 <image_name>:<tag>Open your browser and visit:
http://localhost:8080
The following variables are required:
- region – AWS region where resources will be deployed
- availability_zones – Availability Zones where the subnets are created
- project_name – Used for naming, tagging, and identifying AWS resources
- container_image – SimpleTimeService application container image used in ECS task
update the "terraform.tfvars" variable file as required before terraform apply
cd terraform
terraform init
terraform plan
terraform applyOnce deployment is complete, Terraform will output the ALB DNS name.
Open the URL in your browser to access the SimpleTimeService:
http://<alb-dns-name>
Make sure to use HTTP, not HTTPS, unless SSL is explicitly configured.