Project Title:- Deploy ChatGPT Clone

Project Title:- Deploy ChatGPT Clone

🌟 Project Description

📢 The project involves deploying a ChatGPT clone on AWS ECS(Cluster/container orchestration) using Fargate and AWS ECR(Registry can say Dockerhub for AWS🚀

Tools Used:

  • ☁ AWS console for EC2 instance

  • 📦 Git & GitHub

  • 🔱 Amazon IAM

  • ⚡ AWS CLI

  • 🏪 Amazon ECR

  • 🚀 Amazon ECS

  • 📊📈 Amazon CloudWatch

🌟Setup an ECS cluster

📍Step1: Setup & Launch an EC2 instance

📍Step2: Clone your code from Github repository

git clone https://github.com/dushyantkumark/chatgpt-clone

📍Step3: Create IAM user with attached permissions/policies

First, we have to create a user, attach the necessary policy and then create an access key and secret access key. Go to secret credentials to assign access key and secret access key.

📍Step4:Setup AWS CLI & configure your credentials

Configure AWS using different commands that are available below

sudo apt update
sudo apt-get install awscli 
aws --version
aws configure

📍Step5:It's time to setup Amazon ECR

ECR is an acronym for the Elastic container registry”. In simple terms, it is the so-called AMAZON DOCKER HUB of your containers!

Here are the execution steps:

📍Step6:Issue below commands to push your image from local to ECR

Your Docker file is available in your LOCAL, first login, build the image, again tag that image and pushed to ECR. It is the home for all your pushed docker images where later it can be used by ECS service to get deployed on the AMAZON platform! Command images show below.

Get first error "Docker not found", which means it's time to install Docker in your running instance.

Install docker, ecr public login.

Docker tagged image, inspect the image for the port number which is required for the security group.

After docker push i.e.pushing to AWS ECR. You can verify the status is reflected in ECR or not!

📍Step7:ECS(Amazon Elastic Container Service)

  • CLUSTER: ECS cluster is a regional grouping of one or more container instances on which you can run task requests.When an instance launches, the ECS-agent software on the server registers the instance to an ECS Cluster. You can choose an existing VPC, or create a new one to spin up your container instances.

  • TASK DEFINITION: It is the complete definition of your tasks(in simple terms, your containers) and describes how containers should be provisioned. Here You need to provide a link to ECR’s saved container images, CPU units, Memory, Container ports to expose, network type and many more. Simple terms, you are defining your containers and how to launch them via Task definitions.

  • TASKS: It is nothing but “ A RUNNING CONTAINER “. The description you provided for your containers in TASK DEFINITION, TASKS are the result of that. It can be thought of as a “RUNNING INSTANCE” of a Task Definition.(you can create a service also under the deploy option)

✨STEP 1: CREATE ECR CLUSTER

✨STEP2: CREATE TASK DEFINATION

AWS Fargate is a technology that you can use with Amazon ECS to run containers without having to manage servers or clusters of Amazon EC2 instances. With Fargate, you no longer have to provision, configure, or scale clusters of virtual machines to run containers. This removes the need to choose server types, decide when to scale your clusters, or optimize cluster packing.

When you run your Amazon ECS tasks and services with the Fargate launch type or a Fargate capacity provider, you package your application in containers, specify the Operating System, CPU and memory requirements, define networking and IAM policies, and launch the application. Each Fargate task has its own isolation boundary and does not share the underlying kernel, CPU resources, memory resources, or elastic network interface with another task.

✨STEP3: RUN TASK NOW!

Once you are done with the Run task, click on Running task search for ENI ID and open the port under SG on which your app is running!(FYI: not your instance port as we selected Fargate).

📍Step8: Not access your application

If the application is not accessible check your security group, which your fargate is using.

📍Step9:Here you go and access your app over public ip.

Access your application in any of your browsers.

📍Step10: Logging using Cloud Watch Logs

🌟Conclusion:

This project is important for learning various components of cloud services. It is a combination of vast varieties of tools from basic to advance such as Linux, Git & GitHub, AWS EC2, Docker, ECR, ECS and Clod Watch Logs. In this project, we learn step by step how things are implemented.

\...................................................................................................................................................

The above information is up to my understanding. Suggestions are always welcome. Thanks for reading this article.

#aws #EC2 #Fargate #DevOps #TrainWithShubham #cloudcommunity #ecr #ecs

#90daysofdevops #devopscommunity #happylearning

Shubham Londhe

Follow for many such contents:

LinkedIn: linkedin.com/in/dushyant-kumar-dk

Blog: dushyantkumark.hashnode.dev

GitHub: https://github.com/dushyantkumark/chatgpt-clone

***Happy Learning :)***✌✌

Keep learning, Keep growing🎇🎇

Thank you for reading!! Hope you find this helpful.