ECR, ECS,Fargate-Docker
ECR, ECS,Fargate-Docker
2.Docker on an OS.
docker agent in servers are used to run the various containers in the server.
3.Docker images
Docker Images are the blueprint of everything that can be used to run the
application in the container.
They are stored in the Docker repository. In AWS they are stored in the Docker Hub,
Docker ECR.
Docker Hub: Public Repository
Amazon ECR: Elastic Container Registry it is the private repository.
4.Docker Vs VM
VM Architecture: Infrastructure->Host OS->Hypervisor->VM
Docker Architecture: Infrastructure->VM/EC2->Docker Daemon->Docker, Container.
Docker Daemon: It is the core component of the Docker that helps in creation,
Management and execution of the containers.
Whenever we create an ECS account using the EC2 launch type the ASG is also created
Hands On
ECS->Create Cluster->Infrastructure(EC2 ,Fargate)-> other information than Cluster
is created.
Than Capacity provider are used to assign the number of instances to be created
based on the demands. And if we need to scale up or down the number of EC2
instance SG will come into play.
Explanation:
Container images are stored in ECR. No container are created and left unused. Tasks
are defined that will be used when we require it to work Task definition is just
the Blueprint.
Adding the service means how many tasks to run ,How to connect them ,health checks.
Roles are IAM permission assigned to the instance or the Container.
ECS Capacity providers are used to provide the additional load balancing if we are
using EC2 launch type.
HandsOn2
Create a task definition in the ECS.
Launch Tacks definition as a service.
#Rolling update
From updating the version of the ECS service the downtime is zero.
Where from updating the version of the ECS the number of the tasks can be that can
be started or stopped.
it maintains two parameter. minimum Healthy percentage which defines the minimum
number of the ECS tacks to be healthy for the service to be working and maximum
healthy percentage are the number of the tasks that are maximum number of ECS tasks
that can be added to the System.
The old setup of the ECS service is replaed by the new ECS service without down
time Ex
4 ECS service in V1
Maximum Health can be 100 and minimum health can be 150%
So 2 more task can be created and a opair of old task can be removed and then once
again two more task can be created and two more left over old task can bwe removed
and than complete ECS system gets updated with 0 downtime.
===================================================================================
===================================================================================
====
Amazon ECS Task Definition
The ECS task definition is the JSON file which consist of multiple things but some
of the most important are the:
1.CPU utilization, CloudWatch, IAM role, port and protocols, Docker image,
Environment Variables and Networking information.
Scenario: When connecting the EC2 defined container to the ECS it requires the host
and the container port.
#Data Volumes
A Single Task Definition can have multiple containers involved.
This means that thee task definition is used to involve thee single or the multiple
tsks to perform as a single unit.
So the data needs to be shared between the containers defined in the Task
definition.
There are two types of the containers in the Task definition being Application
containers or the Side car definition.
So for the EC2 launched tasks the EC2 instance storage is only used for the Bind
Mounting.
And for the Fargate launched tasks the Ephermal storage is used.
hands on
While creating an container it is aked if the container is essential or not and if
the e=task is essential and we close the container than the task also closes.
===================================================================================
===================================================================================
====
ECS Task Placement.
Placing of the ECS container launched by the EC2 based on the CPU, memory and
constraints.
Which task to terminate while scaling the ECS.
This can be monitored by using ECS task placement strategy or the Task placement
constraints.
#Whenever an container is build it ECS uses the following process to select the
instance where it shall be placed:
1.Where dos the container fits well in accordance with the memory, CPU and the
Port.
2.Task placement constraints
3.Task placement Strategy.
===================================================================================
===================================================================================
====
ECR:
All the permission to the ECR is managed by the IAM.
===================================================================================
===================================================================================
====
Amazon Copilot.
it is the CLI tool for the build, release and operate the containerized Apps.
Instead on hosting the app and then building it on the AppRunner, ECS or the
Fargate we can directly run the app on the Copilot.
No need to setup the Infrastructure it is done by the AWS itself.
===================================================================================
===================================================================================
====
EKS; elastic Kubernetes Services
It is an open source service that is used to automatically deploy, scale and manage
the Docker container.
Alternate to ECS but the has very different API's
There are two types of the deployment type. EC2 or the Fargate.
It can be used on any cloud platform like GCP., Azure., AWS.
EKS Architecture
There are EKS pods that are running into EKA nodes