Day 85 Task: Project-6
Modernizing Deployment: Node.js App on AWS ECS Fargate & ECR
Project Description
The project involves deploying a Node JS app on AWS ECS Fargate and AWS ECR. Read More about the tech stack here
🔶 Task:
Get a NodeJs application from GitHub.
Create EC2 Instance and Install AWS CLI and Docker:
#!/bin/bash echo "AWS CLI Installation" echo "***********************" sudo apt install -y unzip curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" unzip awscliv2.zip sudo ./aws/install echo "Docker installation" echo "***********************" sudo apt update sudo apt install -y apt-transport-https ca-certificates curl software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt update sudo apt install -y docker-ce docker-ce-cli containerd.io sudo systemctl start docker sudo systemctl enable docker sudo usermod -aG docker ubuntu sudo reboot
Clone the GitHub Repository:
git clone https://github.com/Chandreshpatle28/node-todo-cicd-jenkins.git
Configure AWS ECR:
Navigate to the AWS Elastic Container Registry (ECR) and create a repository.
Check the repo has been created.
Create an IAM user in the AWS Management Console and attach the required policies for our project:
Install the AWS Command Line Interface (CLI) on the AWS EC2 instance :
aws configure
Navigate to the ECR repository created earlier and select View push commands:
Retrieve an authentication token and authenticate your Docker client to your registry. Use the AWS CLI:
Build your Docker image using the following command:
docker build -t chandreshpatle28/node-todo-app .
After the build completes, tag your image so you can push the image to this repository:
docker tag chandreshpatle28/node-todo-app:latest public.ecr.aws/a5e0a3d5/chandreshpatle28/node-todo-app:latest
Run the following command to push this image to your newly created AWS repository:
docker push public.ecr.aws/a5e0a3d5/chandreshpatle28/node-todo-app:latest
Configure AWS ECS:
Create a task definition for your cluster:
Deploy and Run the Task:
Ensure port 8000 is open in the Security Group used in our task:
Click "Run Task" to start running your Node.js app on ECS Fargate! :
In conclusion, this project successfully demonstrated the deployment of a Node.js application on AWS Elastic Container Service (ECS) Fargate using Amazon Elastic Container Registry (ECR).
By following this project, you've learned how to harness the capabilities of AWS services like ECR and ECS to deploy containerized applications. This knowledge is invaluable in the world of DevOps and cloud computing, where containerization and orchestration have become essential practices for building scalable, reliable, and efficient software systems.
As you continue your journey in the realm of DevOps and cloud technology, remember to stay updated with the latest insights and articles to keep sharpening your skills. Whether it's through Hashnode, LinkedIn, or GitHub, staying engaged with the community and sharing your experiences can contribute to the collective knowledge of the tech world.
Thank you for joining this project, and let's keep moving forward together, learning, growing, and making a positive impact in the tech world. Happy learning!
Happy Learning :)
Stay in the loop with my latest insights and articles on cloud ☁️ and DevOps ♾️ by following me on Hashnode, LinkedIn (https://www.linkedin.com/in/chandreshpatle28/), and GitHub (https://github.com/Chandreshpatle28).
Thank you for reading! Your support means the world to me. Let's keep learning, growing, and making a positive impact in the tech world together.
#Git #Linux Devops #Devopscommunity #90daysofdevopschallenge #python #docker #Jenkins #Kubernetes #Terraform #AWS #Grafana