DevOps (Day-85): Project-6 Utilizing AWS ECS Fargate and ECR with a Node JS app

DevOps (Day-85): Project-6 Utilizing AWS ECS Fargate and ECR with a Node JS app

Dear Learners In Today Article we will explain the Deploying a Node JS app with the help of AWS ECS Fargate and AWS ECR.

Table of Contents

Aim

Pre-requisite

Project Steps

Cloning the Source code from GitHub

Configuring image in AWS ECR

Configuring IAM

Pushing the image to ECR

Configuring AWS ECS

Using AWS Fargate

Open port in the Security Group.

Project Live Execution

Aim:-

The Project involves deploying a Node JS app on AWS ECS Fargate and AWS ECR.

Pre-requisite:-

Cloning the Source code form GitHub.

1 Let's go to the GitHub repository and copy the source code URL.

No alt text provided for this image
Cloning the Source code form GitHub Diagram

2 Create an EC2 instance in AWS Management console Navigate to the EC2 instance.

No alt text provided for this image
Create an EC2 instance in AWS Management console Navigate to the EC2 instance Diagram.

3 Clone the repository from GitHub to the EC2 instance.

No alt text provided for this image
Clone the repository from GitHub to the EC2 instance Diagram.

4 Navigate to AWS ECR.

No alt text provided for this image
Navigate to AWS ECR Diagra.

5 Create a repository, I have selected the Public repository and the repo name.

No alt text provided for this image
Create a repository, I have selected the Public repository and the repo name Diagram.

6 Select all the operating system versions according to the OS of Fargate you would select. Finally create the repository.

No alt text provided for this image
Select all the operating system versions according to the OS of Fargate you would select. Finally create the repository Diagram
No alt text provided for this image
Select all the operating system versions according to the OS of Fargate you would select. Finally create the repository Diagram

7 Now you can check the Public repository for the created repository.

No alt text provided for this image
Now you can check the Public repository for the created repository Diagram.

Configuring IAM

8 Create an IAM user in the AWS Management console.

No alt text provided for this image
Create an IAM user in the AWS Management console Diagram.

9 Attach the policies required for accessing the ECR.

No alt text provided for this image
Attach the policies required for accessing the ECR Diagram.

10 Install the awscli in the AWS EC2 instance.

No alt text provided for this image
Install the awscli in the AWS EC2 instance Diagram.

11 Connect the EC2 instance with AWS management console through awscli.

No alt text provided for this image
Connect the EC2 instance with AWS management console through awscli Diagram.

Push the image to ECR

12 Navigating to the AWS ECR and view the push commands Earlier we had pushed the image to DockerHub in my previous blogs. The steps and concepts are similar but the platform differs. Generally in IT industry ECR is used as an image registry.

No alt text provided for this image
Push the image to ECR Diagram.

Execute commands 1 and 2 in the EC2 instance.

Command1 : This will take the ecr token and provide to docker for the connection to the repository.

Command2: This will build the image from the Docker file.

No alt text provided for this image
Command1 : This will take the ecr token and provide to docker for the connection to the repository Diagram.
No alt text provided for this image
Command1 : This will take the ecr token and provide to docker for the connection to the repository Diagram.

14 Execute commands 3 and 4 in EC2 instance.

Command 3 : This tags the image that we have built using docker.

Command 4 :This command will push the image form EC2 instance to ECR.

No alt text provided for this image
Execute commands 3 and 4 in EC2 instance Diagram.

15 After the image push, you can check the ECR for the image.

No alt text provided for this image
After the image push, you can check the ECR for the image Diagram.

Configuring the AWS ECS

16 Navigate to the ECS repository in the AWS console.

No alt text provided for this image
Navigate to the ECS repository in the AWS console Diagram.

17 Create a cluster in ECS.

No alt text provided for this image
Create a cluster in ECS

18 Provide the cluster name,VPC and Subnet you want your application to be avaliable on.

No alt text provided for this image
Provide the cluster name,VPC and Subnet you want your application to be avaliable on Diagram.

Using AWS Fargate

One of the Major disadvantage of using AWS EC2 for an application is we have to create multiple instance in case of an application load increase that will have a cost impact.

To avoid this, we will use AWS Fargate which is a Serverless technique of providing the specification of applications that will be automatically managed without spinning off any instance.

1 Therefore, we will select AWS Fargate for the cluster to run on.

No alt text provided for this image
Therefore, we will select AWS Fargate for the cluster to run on Diagram.

2 The Cluster is now ready !!!

No alt text provided for this image

3 We used to run docker run to create a container in the EC2 instance out of the docker image. That was nothing but a task. Therefore let's create a task definition for our cluster.

No alt text provided for this image
We used to run docker run to create a container in the EC2 instance out of the docker image. That was nothing but a task. Therefore let's create a Di

4 Provide the task name, Container image details and ports for the application to be run on. We must have exposed a port in our Dockerfile.

No alt text provided for this image
Provide the task name, Container image details and ports for the application to be run on. We must have exposed a port in our Dockerfile Diagram.

5 Select the CPU and memory configuration according to the application load.

No alt text provided for this image
Select the CPU and memory configuration according to the application load Diagram.

6 Let the rest be default and click on next.

No alt text provided for this image
Let the rest be default and click on next Diagram.

7 Review the details and create the task.

No alt text provided for this image
Review the details and create the task Diagram.

8 Now, the task is finally created !!!!

9 Click on deploy and then Run task to run the task on the cluster we had crated.

No alt text provided for this image
Click on deploy and then Run task to run the task on the cluster we had crated Diagram.

10 Choose the cluster, Select the launch type to be Fargate.

No alt text provided for this image
Choose the cluster, Select the launch type to be Fargate Diagram.

11 Now Click to create.

No alt text provided for this image
Now Click to create Diagram.

12 The task is now deployed to the cluster.

No alt text provided for this image
The task is now deployed to the cluster Diagram.

Open Port in the security Group.

13 Navigate to the ENI ID in the task.

No alt text provided for this image
Navigate to the ENI ID in the task Diagram.

14 Go to the security group URL.

15 Navigate to the Inbound rule in the security group and open the Port 80 which is HTTP and select my IP to have access for myself.

Project Live Execution

16 Navigate to the task that we created. Take the Public IP.

17 We can see our application is live !!!!!!!!!!!


Hope I helped you in understanding the concept in a better way!!

Happy Learning


Next Topic

Day 86: Deploying a Portfolio app on AWS S3 Bucket using GitHub.

Kowshik G Y

Digital Marketing Associate | Passionate About Digital Transformation & Audience Engagement

1 年

Reserve your spot for our upcoming AWS Discovery Day workshop on securing your AWS cloud. Register today.? Registration Link: https://lnkd.in/g4Vwx-pn

  • 该图片无替代文字
回复
Lasantha Sanjeewa Silva

DevOps Engineer @ IFS | AWS SAA Certified | AWS Community Builder | Enabling DevOps

1 年

Good Job

Shubhlaxmi Shukla

kubernetes openstack docker linux

1 年

Well done

Nayan Chaudhari

Immediate Joiner | Searching for opportunities in Linux and AWS | RHCSA & RHCE Certified | Docker | Ansible | Shell Scripting | Preferred Location - Pune, Mumbai, Nashik, Ahemdabad, Indore, Surat, Vadodara

1 年

Good job. Keep it up

Maninder Singh

AWS || Networking || Docker || Mentor & Tutor || System Engineer Antier Solution

1 年

++

回复

要查看或添加评论,请登录

Maninder Singh的更多文章

  • Artificial Intelligence for DevOps Engineer

    Artificial Intelligence for DevOps Engineer

    Dear learners, In today article we will explain the Artificial Intelligence for the DevOps Engineers. Important Aspects…

    12 条评论
  • Bash Shell Scripting:- Lesson 7,8 &9 for DevOps Engineers.

    Bash Shell Scripting:- Lesson 7,8 &9 for DevOps Engineers.

    Dear Learners, In Today Topic, We will learn the Shell Scripting form Basics to Advanced for DevOps Engineers. Course…

    3 条评论
  • Bash Shell Scripting:- Lesson 4,5 &6 for DevOps Engineers.

    Bash Shell Scripting:- Lesson 4,5 &6 for DevOps Engineers.

    Dear Learners, In Today Topic, We will learn the Shell Scripting form Basics to Advanced for DevOps Engineers. Course…

    3 条评论
  • Bash Shell Scripting:- Lesson 1,2 &3 for DevOps Engineers.

    Bash Shell Scripting:- Lesson 1,2 &3 for DevOps Engineers.

    Dear Learners, In Today Topic, We will learn the Shell Scripting form Basics to Advanced for DevOps Engineers. Course…

    3 条评论
  • EP 2 DevOps:- 2 Tier Application Deployment

    EP 2 DevOps:- 2 Tier Application Deployment

    2-Tier Application Deployment Diagram (Architecture) Dear Learners in today topic we will deploy a 2 Tier Application…

    8 条评论
  • DevOps Engineers:- Docker Cheat Sheet

    DevOps Engineers:- Docker Cheat Sheet

    Dear learner, presented below is a concise yet comprehensive Docker cheat sheet, complete with detailed commands and…

    7 条评论
  • DevOps (Day-90): Ending the challengs

    DevOps (Day-90): Ending the challengs

    Table of Contents: Flashback Self-Impact of Learning Today, We have completed the 90days of DevOps challenge where we…

    16 条评论
  • DevOps (Day-88): Kubernetes Architecture

    DevOps (Day-88): Kubernetes Architecture

    Dear Learner's in today topic we will discuss the Kubernetes Architecture in detail. Table of Contents Kubernetes…

    1 条评论
  • DevOps (Day-87): Argo CD

    DevOps (Day-87): Argo CD

    Dear Learners in today topic we will the discuss the Argo CD in Kubernetes. Table of Contents Challenges with CD into…

    13 条评论
  • DevOps (Day-86): Project-7 Portfolio App

    DevOps (Day-86): Project-7 Portfolio App

    Dear Learners in Today's article we will deploying a Portfolio app on AWS S3 Bucket using GitHub. Table of Contents:…

    10 条评论

社区洞察

其他会员也浏览了