ECS, ECR & Fargate Flashcards
(32 cards)
What are the 2 launch types for Amazon ECS? How do each differ in how they scale?
EC2 Launch Type - Must provision how many EC2 instances you want.
Fargate Launch Type - Serverless! Increase the number of ECS “Tasks”.
When using EC2 launch type, what instance IAM role is used, who is it used by, and what does it proivide access to?
EC2 Instance Profile which is used by the ECS agent to make calls to ECS Services, send logs, access ECR etc.
When running an ECS task, how would you manage what resources that ECS task can access?
ECS Task Role which is defined in the task definition
When using ECS, which load balancer is normally recommended? If you need higher throughput, what load balancer might you consider?
Application Load Balancer for most usecases and Network Load Balancer if high throughput is required.
What service would you use to mount a file system to ECS tasks?
EFS as it is compatible with EC2 and Fargate launch types.
If you’re use case requires serverless, what is a good combination of services?
Fargate with EFS
What do you use to autoscale at the task level with ECS and what can it be based on?
AWS Application Auto Scaling based on
1. ECS Service Average CPU Utilization
2. ECS Service Average MEmory Utalisation
3. ALB request Count Per Target
What are your two options to autoscale at the EC2 instance level?
Autoscaling Group
ECS Cluster Capacity Provider (Preferred)
What are the two parameters you must set when configuring ECS Rolling Update
Min % and Max %
Describe the “ECS tasks invoked by Event Bridge” architecture
- Setup a ECS cluster backed by Fargate.
- When an S3 bucket is written to, it writes to Amazon Eventbridge.
- Amazon EventBridge has a rull to Run ECS task for each event.
- ECS Task uses its role to access S3 and write the result to a target.
Suppose you want to be notified when an ECS task fails for some reason, what setup could you utalise?
When the ECS task exists, an event can be created in EventBridge that will trigger a SNS event to send an email.
What are 7 primary fields in the ECS task Definition JSON document?
- Image Name
- Port Binding for Container and Host
- Memory and CPU required
- Environment variables
- Networking information
- IAM Roles
- Logging config
When running an ECS service with the EC2 task type, what much each underlying EC2 instance run?
The ECS agent
How many containers can be defined in a single Task definition?
10
Given that when you only define the container port
(EC2 Launch Type) in the task definition you get Dynamic Host Port Mapping, what must you do to ensure to allow an ALB to access the task?
Allow EC2 instances secrutiy group any port from the ALB’s security group
When using load balancing with Fargat, what port must you define (and which must you not).
Only define the container port, the host port is not applicable).
How many task roles can be assigned per task definition
1 to 1
When you have secret environment variables for ECS, where can you store them?
- SSM Paramter Store
- Secrets Manager
When you need to share information between multiple containers in the same task definition, what would you use for EC2 and Fargate tasks respectively
EC2 - EC2 instance storage (data are tied to the lifescycle of the EC2 instance)
Fargat Tasks (using ephemeral storage, data tied to the containers using them)
Define the Binpack task placement strategy on ECS.
Places tasks based on the least available amount of CPU or memory
Define the Spread task placement strategy on ECS
Distribute the tasks evenly across then instances
What is the distinctInstance placement constraint?
Place each task on a difference container instance
What is the memberOf placement constraint
Place task on instances that satisfy an expression written in cluster query language.
In order to access ECR, what must be assigned to the EC2 instance?
IAM Role