# AWS Day 38: Deploying Containerized Applications with Amazon ECS

Containerization has become the standard way to package and deploy modern applications. Instead of installing software directly on virtual machines, developers package everything—including dependencies—inside Docker containers.

AWS simplifies container deployments through two powerful managed services:

*   **Amazon Elastic Container Registry (ECR)** for storing Docker images.
    
*   **Amazon Elastic Container Service (ECS)** for running containers.
    

When combined with **AWS Fargate**, you don't even need to manage EC2 instances. AWS provisions and manages the infrastructure while you focus on your application.

In today's lab, I deployed a Dockerized web application from Amazon ECR to Amazon ECS using the Fargate launch type.

## Step 1 — Create a Private Amazon ECR Repository

Created a private repository named:

```plaintext
xfusion-ecr
```

This repository securely stores Docker images that can later be deployed to Amazon ECS.

![](https://cdn.hashnode.com/uploads/covers/6683e9700c2137ac86599d6e/aa56cf4b-7953-41d8-9f78-157d19c76ef5.png align="center")

## Step 2 — Authenticate Docker with Amazon ECR

Logged in to Amazon ECR using AWS CLI.

This allows Docker to push images securely into the private repository.

![](https://cdn.hashnode.com/uploads/covers/6683e9700c2137ac86599d6e/bd48f01f-94fa-4033-80d4-481bd686d924.png align="center")

## Step 3 — Build Docker Image

Built the Docker image from the Dockerfile located inside:

```plaintext
/root/pyapp
```

After building successfully, Docker generated the local image.

![](https://cdn.hashnode.com/uploads/covers/6683e9700c2137ac86599d6e/407bc5a1-665a-40a8-8d4b-68c23397df20.png align="center")

## Step 4 — Tag the Docker Image

Tagged the image using the repository URI.

Using tags helps version container images and identify releases.

![](https://cdn.hashnode.com/uploads/covers/6683e9700c2137ac86599d6e/c6db4ca2-d9fc-4eaf-b0ef-15828888843d.png align="center")

## Step 5 — Push Docker Image to Amazon ECR

Pushed the image successfully to Amazon ECR.

Now the image becomes available for ECS deployments.

![](https://cdn.hashnode.com/uploads/covers/6683e9700c2137ac86599d6e/f0548eac-ce0d-4fa8-a81a-075929f8c0d2.png align="center")

## Step 6 — Create Amazon ECS Cluster

Created an ECS Cluster named:

```plaintext
xfusion-cluster
```

Selected

*   AWS Fargate  
    

instead of EC2 launch type.

Since Fargate is serverless, AWS manages the infrastructure automatically.

![](https://cdn.hashnode.com/uploads/covers/6683e9700c2137ac86599d6e/7e977457-cbdf-4077-9387-1e34f6bd0d1a.png align="center")

## Step 7 — Create ECS Task Definition

Created

```plaintext
xfusion-taskdefinition
```

Configured

*   Docker Image URI  
    
*   CPU  
    
*   Memory  
    
*   Port Mapping  
    

The Task Definition acts as a blueprint describing how the container should run.

![](https://cdn.hashnode.com/uploads/covers/6683e9700c2137ac86599d6e/9a96e00f-0c72-44a6-8eed-9d844024d6ed.png align="center")

## Step 8 — Create ECS Service

Created

```plaintext
xfusion-service
```

Configured the service to maintain:

*   Desired Tasks = 1  
    

This ensures ECS automatically keeps one healthy container running.

![](https://cdn.hashnode.com/uploads/covers/6683e9700c2137ac86599d6e/0a5adfab-41dc-4f29-995a-efbd7b329bb7.png align="center")

## Step 9 — Verify Deployment

Once deployment completed,

The task entered the **Running** state.

Accessing the application through the public IP displayed the web page successfully.

Deployment completed successfully.

![](https://cdn.hashnode.com/uploads/covers/6683e9700c2137ac86599d6e/5857f57f-2923-4d19-ab78-d81a56d0608c.png align="center")

## Conclusion

This lab demonstrated a complete end-to-end container deployment workflow on AWS. Starting with a Docker image, storing it securely in Amazon ECR, and deploying it through Amazon ECS Fargate highlights how AWS simplifies modern application deployment without requiring server management.

Understanding Amazon ECS, Amazon ECR, and AWS Fargate is a foundational skill for Cloud Engineers and DevOps Engineers building scalable, cloud-native applications.
