DEV Community

Cover image for Amazon ECS & ECR — Container Workflow Explained
Darshan Patil
Darshan Patil

Posted on Originally published at builder.aws.com

Amazon ECS & ECR — Container Workflow Explained

🐳 Amazon ECS & ECR — Container Workflow Explained

Confused about ECS and ECR? Here's the simple flow:

ECR is where your Docker image lives.
ECS is where that image runs as a container.

The workflow

  1. Build your Docker image — FROM nginx
    Package your application into a Docker container image, here netflix-nginx.

  2. Push it to Amazon ECR
    Amazon ECR (Elastic Container Registry) is a secure, fully-managed container registry. It stores the netflix-nginx image with versioning, encryption and access control.

  3. Amazon ECS pulls it and runs it
    Amazon ECS (Elastic Container Service) orchestrates and runs containers as a managed service. A task definition defines how the container runs — CPU, memory, network — and the ECS cluster runs it, using image netflix-nginx:latest.

  4. The ECS Service keeps your tasks running
    ECS launches and manages tasks on AWS Fargate (serverless, no servers to manage) or Amazon EC2 (instances you manage). The service maintains your desired count of tasks running.

  5. The Application Load Balancer routes traffic
    The ALB routes traffic to healthy tasks — Netflix Task 1 and Netflix Task 2 — so external users reach the app through the ALB DNS, load-balanced across tasks.

How it all fits

ECR stores your container image securely → ECS pulls the image from ECR and runs it in a task → ALB distributes traffic to tasks for high availability.

Key benefits

  • Scalable — auto-scale tasks based on demand
  • Reliable — health checks and auto-replacement
  • Secure — IAM roles, VPC and private networking

That's how the same Netflix landing page runs in production.

About the author

Darshan Patil — DevOps | AWS Cloud | Terraform | Docker | Jenkins
GitHub: github.com/darshanpatil8799
LinkedIn: linkedin.com/in/darshan-devops
Builder Center: builder.aws.com/profile — @darshpatil

Top comments (0)