Skip to content

Latest commit

 

History

History
120 lines (96 loc) · 5.8 KB

AWS-ECR-ECS.md

File metadata and controls

120 lines (96 loc) · 5.8 KB

AWS Elastic Container Registry

  • Elastic : It is scalable and available in nature -- Increase the capacity
  • Container : A pkg which container the application code and it's dependencies to run the application.
  • Registry : Container Registry -- (Similary to DockerHub, Quay.io or GCR) -- Used to store the docker images

Difference b/w ECR & Dockerhub

image

  • Dockerhub -- It is public and free to use, we have options like public repos and private repos
  • Dockerhub -- User have to register with their own account
  • ECR -- It supports private repos, bydefault it will create private repo
  • ECR -- IAM USERS integrate with ECR
  • ECR -- Have good integration with other AWS services like EKS

Create ECR

  1. Search for ECR image
  2. Image scan image

Push images to ECR

  1. WE NEED AWS CLI installed in the system
  2. Link https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
  3. Click on Repo and click on view push commands
  4. image
  5. ECR login usig AWS CLI - Similar to docker login using CLI image
  6. NOTE : DOCKER SHUOLD BE INSTALLED BEFORE USING THIS
  7. and follow the commands to push
  8. image

----------------------------------------------------------


Problems with docker

image

  • Auto Scaling
  • Auto Healing

image

image

image

ECS only for AWS

  • ECS does not have all the features of KUBERNTES
  • Kubernetes have Custom Resource Definiations -- Extend the capability of kubernetes
  • Kubernetes -- we have use ingress controller + we have lot of controllers we can add to it

image

ECS advantages

  • Server - EC2
  • Serverless - Forgate

image

EKS

  • Simple architecture

image

Structure of ECS

image

  1. We have to create a CLUSTER on aws
  2. Fargate or EC2
  3. Task defination (Like pod)
  4. Task is one which is running the Container
  5. Once the containers are running we can add the SERVICE
  6. this SERVICE will add Load Balancer, Ingreee policies
  7. It have IAM

REF LINK 1 : https://github.com/pavankumar0077/aws-devops-zero-to-hero/tree/main/day-20 REF LINK 2 : https://github.com/pavankumar0077/aws-devops-zero-to-hero/tree/main/day-21 REF LINK3 : https://mrdevops.hashnode.dev/compare-amazon-ecs-vs-eks

AWS ECS - Create container

Step 1:

  1. Search for ECS -->
  2. Here we are going with serverless fargate
  3. image
  4. Create docker image and push to ECR

Create ECR and push image

aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 794982227033.dkr.ecr.us-east-1.amazonaws.com
docker build -t 794982227033.dkr.ecr.us-east-1.amazonaws.com/demo-repo:latest .
sudo docker images
docker push 794982227033.dkr.ecr.us-east-1.amazonaws.com/demo-repo:latest

image

Create Container ECS

Step 2 : Click on Task Defination

  1. Task role -- container wants to talk to any other service like cloudwatch or s3 etc

  2. image

  3. image

  4. image

  5. Remaining details are same

  6. Create it

  7. Run the task defination : image

  8. If you need anything to change you can do it image

  9. Cluter : image

  10. image

  11. image

  12. Logs from cloudwatch : image

  13. Task execution role -- Agent wants to talk with other services

  14. Task execution -- integrate with cloudwatch