Professional Documents
Culture Documents
Amazon ECS
» » » » Amazon ECS
Amazon ECS eliminates the need for you to install, operate, and
scale your own cluster management infrastructure.
Launch Types
An Amazon ECS launch type determines the type of infrastructure on
which your tasks and services are hosted.
There are two launch types and the table below describes some of
the differences between the two launch types:
The following diagram shows the two launch types and summarises
some key differences:
ECS Terminology
The following table provides an overview of some of the terminology
used with Amazon ECS:
A default cluster is created but you can then create multiple clusters
to separate resources.
Clusters can contain tasks using the Fargate and EC2 launch type.
For clusters with the EC2 launch type clusters can contain different
container instance types.
You can create IAM policies for your clusters to allow or restrict
:
users’ access to specific clusters.
The EC2 instances used as container hosts must run an ECS agent.
Images
Containers are created from a read-only template called an image
which has the instructions for creating a Docker container.
You can use Amazon ECS “Run task” to run one or more tasks once.
:
Task Placement Strategy
A task placement strategy is an algorithm for selecting instances for
task placement or tasks for termination. Task placement strategies
can be specified when either running a task or creating a new
service.
attribute:ecs.instance-type == t2.small
task:group == service:production
Service Scheduler
You can schedule ECS using Service Scheduler and Custom
Scheduler.
Custom Scheduler
You can create your own schedulers to meet business needs.
Auto Scaling
Service Auto Scaling
When you associate an ECS Capacity Provider with an ASG and add
the Capacity Provider to an ECS cluster, the cluster can now scale
your ASG automatically by using two new features of ECS:
Security/SLA
EC2 instances use an IAM role to access ECS.
ECS tasks can have IAM Roles attached (including Fargate tasks).
ECS tasks use the IAM role to access services and resources.
The container agent makes calls to the ECS API on your behalf
through the applied IAM roles and policies.
You need to apply IAM roles to container instances before they are
launched (EC2 launch type).
Best practices:
Use the single container platform when you only need to run one
container per instance.
Multicontainer Docker
ECS cluster.
EC2 container instances.
Load balancers (for high availability mode).
Task definitions and execution.
Note: In the AWS CLI version 1 the command is aws ecr get-login
(without the -password). This is still appearing in the exam.
Pull the image using the docker pull command. The image name
format should be registry/repository[:tag] to pull by tag,
or registry/repository[@digest] to pull by digest.
docker pull
aws_account_id.dkr.ecr.region.amazonaws.com/my-web-
app:e9ae3c220b23
Click the image above to watch the FREE Video Tutorial on Amazon
ECS with Elastic Load Balancing
:
Amazon ECS with Elastic Load Balancing
You can specify a dynamic port in the ECS task definition which
gives the container an unused port when it is scheduled on the EC2
instance (this is specific to ALB only).
References
https://docs.aws.amazon.com/AmazonECS/latest/userguide/Welcom
e.html
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/We
lcome.html
https://aws.amazon.com/ecs/faqs/
:
https://aws.amazon.com/ecs/resources/
https://aws.amazon.com/ecs/pricing/
: