DevOps Project-6
Project Description
The project involves deploying a Node JS app on AWS ECS Fargate and AWS ECR.
Read More about the tech stack here.
Prerequisites
A t2micro EC2 Ubuntu instance with Docker installed and AWS CLI configured.
You can refer to my previous blogs for the same.
Step 1: Clone the Application:
git clone https://github.com/pmgoriya/node-todo-cicd.git
Step 2: Build the Docker Image:
Run the following command to create a Docker Image from the Dockerfile:
docker build -t node-todo-cicd .
Step 3: Set Up AWS ECR:
Access your AWS account and create a public Elastic Container Registry (ECR).
Step 4: Push the Docker Image to ECR:
Navigate to the ECR and click on "View push commands."
Execute these commands in your terminal, ensuring the prior installation and configuration of the AWS CLI.
Click here to learn more about AWS CLI
It is not recommended but for the sake of the project you can create access keys for the root user as shown in the above link.
Verify the successful creation and upload of your image in ECR.
Step 5: Create a Cluster in AWS ECS:
Provide details such as Cluster name, and choosing AWS Fargate in Infrastructure.
A cluster named todo-app has been created.
Step 6: Define a Task:
Fill in the Task Definition family and Infrastructure details, including Launch Type, OS architecture, Task size, and Task role.
Specify Container details such as the port number, Image URI (ECR link), container name, port name, and resource allocation limits.
Also make sure to create a custom security group and open the port 8000 for the access of our app.
Click on Create.
A task definition has been successfully created.
Step 7: Run the Task and Deploy:
Click on Deploy -> Run Task.
Choose the existing cluster, review and modify configurations if needed.
Click on Create.
Your task is now launched and is provisioning the necessary infrastructure for execution.
Observe that your task has been provisioned and is currently running.
Retrieve the IP address from the running task and open it in the browser at port number 8000.
Thanks for following the project. See you in the next one.