Deploying a Todo App on AWS ECS with ECR: A Step-by-Step Guide

Deploying a Todo App on AWS ECS with ECR: A Step-by-Step Guide

Day 85: Deploying a Web App on AWS ECS with ECR


In the ever-evolving landscape of cloud computing, deploying applications has become more efficient and scalable. Amazon Web Services (AWS) offers a suite of services that enable developers to deploy and manage applications with ease. In this guide, we'll walk through the process of deploying a Todo app on AWS ECS (Elastic Container Service) using ECR (Elastic Container Registry). This tutorial assumes you have a basic understanding of AWS services and have an AWS account.

Step 1: Set Up an EC2 Instance

To get started, you'll need to launch an EC2 instance.

  1. Launch an EC2 Instance:

    • Use the AWS Management Console to launch an EC2 instance with Amazon Linux or any other suitable Amazon Machine Image (AMI).
  2. SSH into the Instance:

     ssh -i your-key.pem ec2-user@your-instance-ip

Step 2: Clone the Todo App Repository

Once you're connected to your EC2 instance, clone your Todo app repository.

Clone the Repository:

git clone
cd todo-app

Step 3: Set Up ECR Repository

Next, we'll create an ECR repository to store our Docker image.

  1. Navigate to ECR in the AWS Management Console:

  2. Create a New Repository:

    Name the repository node-app.

Step 4: Install Docker and AWS CLI on EC2 Instance

Install Docker and the AWS CLI to manage and deploy your application.

Install Docker and AWS CLI:

sudo apt update -y
sudo apt install
sudo usermod -a -G docker ubuntu
curl "" -o ""
sudo ./aws/install

Step 5: Authenticate Docker with ECR

Authenticate your Docker client with your ECR registry to push your Docker images.

Authenticate Docker:

aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin

Step 6: Build and Push Docker Image to ECR

Build your Docker image and push it to your ECR repository.

  1. Build and Tag Docker Image:

     docker build -t node-app .
     docker tag node-app:latest
  2. Push Docker Image to ECR:

     docker push

Step 7: Create ECS Cluster

Now, we’ll create an ECS cluster to run our application.

  1. Navigate to ECS in the AWS Management Console:

  2. Create a New Cluster:

    • Name the cluster node-todo-cluster.

    • Choose Fargate as the launch type.

Step 8: Create Task Definition and Deploy

Define the tasks that will run on your ECS cluster.

  1. Create a New Task Definition:

    Name it node-todo-app-task-definition.

  2. Deploy the Task:

    Select the task definition and click on "Deploy", then "Run Task".

Step 9: Check the App

Finally, ensure your application is running.

  1. Get the Public IP of Your Fargate Instance

  2. Open a Web Browser:

    Navigate to http://<public-ip>:8000 to check if the Todo app is running.


Congratulations! You've successfully deployed a Todo app on AWS ECS using ECR. This step-by-step guide covered setting up an EC2 instance, cloning the Todo app repository, configuring ECR, installing Docker and AWS CLI, building and pushing a Docker image, creating an ECS cluster, defining tasks, and finally deploying and checking the app. This workflow provides a scalable and efficient way to deploy containerized applications on AWS.

Happy Learning!

Follow me on LinkedIn.