ECS Flashcards
What are the ECS launch types?
EC2
* launches EC2 instances to run the docker containers by running ECS agent on the instances
* you need to maintain the EC2 instances
Fargate
* serverless
* you do not need to maintain the infrastructure
What are IAM roles for ECS?
EC2 instance profile
* used by the ECS agent on EC2 launch type
ECS task role
* allows each task to have a specific role
What if you want to persist data on ECS?
You will need to mount EFS file systems onto ECS tasks
What are the two types of scaling on EC2 launch type?
Auto scaling group scaling
* scale your ASG based on CPU utilization
* Add EC2 instances over time
ECS cluster capacity provider
* automatically provision and scale the infrastructure for the ECS tasks
* capacity provider paired with an ASG
What happens when a version update happens on ECS?
A rolling update is performed. So, tasks with the new version are born, while old tasks are still up. When new version is healthy, old tasks are killed.
Minimum and maximum healthy percent can be set.
* minimum - how much is allowed to terminate when performing a version update - old version
* maximum - how much is allowed to create when performing a version update - new version
What are ECS task definitions?
Are the metadata in JSON form to tell ECS how to run the docker container.
Env variables can be hardcoded, on SSM, Secrets manager and S3
Data volumes are shared data between multiple containers in the task definition, use case: share ephemeral data between containers
What are ECS task placements strategies and its benefits?
- Binpack - place tasks based on the least available of CPU or memory. Good for saving money - tries to fill up containers on a single instance
- Random
- Spread - place the task evenly based on the specified value - AZ, InstanceId…
What are ECS task placements constraints?
Are restrictions where to not place the task. Example:
* distinctInstance - place each task on a different instance
* memberOf - places task on instances that satisfy an expression