Sunday, July 27, 2025

Docker Containers | Management on AWS ECS , EKS, Farget, & ECR.

 

Here's twtech breakdown of how Docker containers are managed on AWS using ECS, EKS, Fargate, and ECR:

Docker Containers on AWS

1. Amazon ECR (Elastic Container Registry) – Container Image Storage

  • What it is: A fully managed Docker container registry that stores container images.
  • Use case: twtech pushes Docker images to ECR, then ECS/EKS pulls from it to run containers.
  • Key Features:
    • Secure, private repository
    • Integrated with IAM for access control
    • Supports vulnerability scanning

 Workflow:

# bash

# Tag and push a Docker image to ECR

docker tag twtechapp:latest 98xxxxxxxxx.dkr.ecr.us-east-2.amazonaws.com/twtechapp:latest

aws ecr get-login-password | docker login --username AWS --password-stdin ...

docker push 98xxxxxxxx.dkr.ecr.us-east-2.amazonaws.com/twtechapp:latest

2. Amazon ECS (Elastic Container Service) – AWS-native Orchestration

  • What it is: A container orchestration service that runs Docker containers using a simple configuration.
  • Launch Types:
    • Fargate (serverless)
    • EC2 (twtech manages EC2 instances)
  • Use case: Easy-to-use solution for deploying, scaling, and managing containers.

 ECS Concepts:

  • Task Definition: JSON blueprint describing container(s)
  • Task: A running instance of a Task Definition
  • Service: Maintains the desired number of tasks
  • Cluster: A logical grouping of resources

3. AWS Fargate – Serverless Compute Engine

  • What it is: A serverless compute engine for containers that works with ECS and EKS.
  • Use case: Run containers without provisioning or managing servers.
  • Benefits:
    • Pay-per-use
    • No EC2 instance management
    • Scales automatically

 Best For:

  • Short-lived jobs
  • Microservices
  • When twtech wants to focus only on containers, not infrastructure

4. Amazon EKS (Elastic Kubernetes Service) – Kubernetes on AWS

  • What it is: Managed Kubernetes service to run containerized applications.
  • Use case: If is already already using Kubernetes or want more flexibility and community tools.
  • Architecture:
    • Control Plane managed by AWS
    • Worker nodes (self-managed EC2 or Fargate)

 EKS Concepts:

  • Pods: Smallest deployable unit (can have 1+ containers)
  • Deployments: Define how to manage pods
  • Node Groups: EC2 instances that run pods

 Comparison Table

Feature

ECS (EC2)

ECS (Fargate)

EKS (EC2)

EKS (Fargate)

Infra Mgmt.

twtech manages EC2

Fully managed

twtech manages EC2

Fully managed

Complexity.

Low

Very low

Medium-high

Medium

Flexibility.

AWS-specific

AWS-specific

Very flexible

Very flexible

Cost Control.

More control

Pay-per-use

More control

Pay-per-use

Learning Curve.

Low

Very low

High

Medium-high

Use Cases by Service

Scenario

Best AWS Service

Simple web app with low maintenance.

ECS + Fargate

Large-scale microservices architecture.

EKS (Kubernetes)

Full control over VMs.

ECS with EC2

CI/CD pipeline storing Docker images.

ECR

Kubernetes expertise/team.

EKS

 twtech-Typical Workflow (ECS + Fargate + ECR)

  1. Build Docker image
  2. Push to Amazon ECR
  3. Define ECS Task Definition
  4. Create ECS Service with Fargate launch type
  5. Monitor via CloudWatch and ECS Console. 

No comments:

Post a Comment

Kubernetes Clusters | Upstream Vs Downstream.

  The terms "upstream" and "downstream" in the context of Kubernetes clusters often refer to the direction of code fl...