Skip to content

yjin0819/Cloud-classification-model-deployment

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

423-2025-hw3-flj5370 - Cloud Classifier on AWS ECS

This project is a containerized Streamlit application deployed on AWS using ECS Fargate with an Application Load Balancer (ALB). This README walks through the full setup: local testing, Docker image creation, ECR push, and ECS service deployment.


1. Local Development & Testing

Project Structure

.
├── app/
│   ├── main.py
│   ├── logger.py
│   ├── model_loader.py
│   ├── predictor.py
│   └── models/
├── requirements.txt
├── Dockerfile

Run Unit test

pytest test/

Test Locally

docker build -t cloud-classifier .
docker run -p 8501:8501 cloud-classifier

Visit: http://localhost:8501


2. Build & Push Docker Image to ECR

Create an ECR Repository

In AWS Console > ECR > Create private repo (e.g. cloud-classifier).

Build, Tag, and Push Image

docker build -t cloud-classifier .
docker tag cloud-classifier:latest <account-id>.dkr.ecr.us-east-2.amazonaws.com/cloud-classifier:latest
docker push <account-id>.dkr.ecr.us-east-2.amazonaws.com/cloud-classifier:latest

You neeed to replace the address with your own ECR address.

3. Deploy on ECS Fargate

Task Definition

  • Launch type: Fargate
  • Task role: TaskAppRole
  • Execution role: TaskExecutionRole
  • Container name: cloud-classifier
  • Image: paste full ECR image URI
  • Port mapping: 8501

ECS Service + Load Balancer

Cluster

  • Use or create ECS Cluster (e.g. cloud-hw3)

Service

  • Launch type: Fargate
  • Number of tasks: 1
  • Load balancing: Enabled

ALB

  • Type: Application Load Balancer
  • Listener: Port 80, Protocol HTTP
  • Target group:
    • Name: cloud-classifier-tg
    • Protocol: HTTP
    • Health check path: / or your Streamlit endpoint
    • Port: 8501

Networking

  • Choose public subnets (with internet access)
  • Assign public IP
  • Choose a Security Group that allows:
    • Inbound Rule: HTTP port 80 from 0.0.0.0/0
    • All traffic from self SG (for internal)

4. Access Your App

Once the deployment shows 1/1 Tasks Running and ALB is healthy:

  1. Go to EC2 > Load Balancers
  2. Copy the DNS name of the ALB
  3. Open: http://<alb-dns-name>

Tips

  • ALB port 80 is external. Inside the container, the app runs on port 8501.
  • Health checks should use a valid path that returns HTTP 200.
  • If you modify image, push new tag and update ECS task definition.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 87.5%
  • Dockerfile 12.5%