Deployment of node-todo-app on ECS

Deployment of node-todo-app on  ECS

Objective of this project

The objective of deploying a Node.js Todo application on ECS is to demonstrate how to build and deploy web application using containers and container orchestration.

The project include the following steps:

  1. Build the Docker image of the Node Todo application

  2. Push the Docker image to Amazon Elastic Container Registry (ECR)

  3. Define the ECS Task Definition and Service for the application

  4. Create an ECS Cluster and configure it to use the Task Definition and Service

  5. Test and monitor the logs of your application to ensure it is running correctly

By completing this project, you will have a better understanding of how to deploy containerized applications on AWS using ECS and related services, and how to configure and manage your web applications.

Prerequisite

You should have an AWS Account that's it!!!

Services used in this project

IAM, ECS, ECR, DOCKER, Cloudwatch

A brief explaination of these terms

IAM: IAM stands for Identity and Access Management. It is a service provided by AWS that allows you to manage users and their permissions to access your resources. With IAM, you can create and manage users, groups, and roles to control who can access your AWS resources and what actions they can perform.

ECS: ECS stands for Elastic Container Service. It is a fully-managed container orchestration service provided by AWS that makes it easy to run, stop, and manage Docker containers on a cluster of EC2 instances. ECS allows you to deploy and scale your applications in a flexible and efficient way.

ECR: ECR stands for Elastic Container Registry. It is a fully-managed Docker container registry provided by AWS that makes it easy to store, manage, and deploy Docker container images. ECR allows you to push and pull Docker images securely and seamlessly, making it a convenient solution for managing container images in your applications.

DOCKER: Docker is a popular open-source platform that allows you to package and run applications in containers. Containers are lightweight, portable, and self-contained environments that can run on any platform, making it easy to deploy and scale applications. Docker provides tools and services to build, ship, and run containerized applications, making it a popular choice for building and deploying modern applications.

CLOUDWATCH: Amazon CloudWatch is a monitoring and observability service provided by AWS that allows you to collect and track metrics, collect and monitor log files, and set alarms. It helps you to gain visibility into your applications, infrastructure, and services running on AWS or on-premises.

Let's get started

Step:1 Create an IAM user by following the AWS principle of least privilege

Attach policies according to the work

Step 2: Create a Cluster on ECS

Cluster

In Amazon ECS, a cluster is a grouping of one or more container instances (i.e., EC2 instances or Fargate instances) on which you can run Docker containers. A cluster acts as a logical boundary for your tasks and services, allowing you to isolate and manage your containerized applications at scale.

Created a cluster by name node-todo-cluster

Step 3: Create a Public Repository in ECR

Step 4:Create Access key and secret key for your IAM user to access through AWS CLI

Step 5: Launch an Instance and access it doing ssh.

Install docker and configure aws

Step 5: Clone your repo

Step 6: Now go to ECR and create a public repo in it view push commands

So here i got the error, basically, this error was I don't have the permissions to create a repository.

To resolve this issue, I just gave the right permission to the user through IAM service

Step 6: Now view push commands

Paste all the commands one by one on the instance

Step 7: Go back to ECR and check the image that you pushed

I forgot to take a screenshot of the image!!! but the image was there trust me:)

Step 8:Go to ECS and make a task definition for your cluster

Created task definition now run the task

Step 9: Copy the Public IP of your task and paste it into browser

Step 10:Go to cloudwatch and watch the logs

Firstly i attach the policy of AWS Cloudwatchlog full access to the user

Go to log groups

THAT'S ALL FOR TODAY'S LEARNING I HOPE YOU LEARN SOMETHING FROM THIS BLOG