ECS, ECR & Fargate Flashcards

(32 cards)

1
Q

What are the 2 launch types for Amazon ECS? How do each differ in how they scale?

A

EC2 Launch Type - Must provision how many EC2 instances you want.
Fargate Launch Type - Serverless! Increase the number of ECS “Tasks”.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

When using EC2 launch type, what instance IAM role is used, who is it used by, and what does it proivide access to?

A

EC2 Instance Profile which is used by the ECS agent to make calls to ECS Services, send logs, access ECR etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

When running an ECS task, how would you manage what resources that ECS task can access?

A

ECS Task Role which is defined in the task definition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

When using ECS, which load balancer is normally recommended? If you need higher throughput, what load balancer might you consider?

A

Application Load Balancer for most usecases and Network Load Balancer if high throughput is required.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What service would you use to mount a file system to ECS tasks?

A

EFS as it is compatible with EC2 and Fargate launch types.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

If you’re use case requires serverless, what is a good combination of services?

A

Fargate with EFS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What do you use to autoscale at the task level with ECS and what can it be based on?

A

AWS Application Auto Scaling based on
1. ECS Service Average CPU Utilization
2. ECS Service Average MEmory Utalisation
3. ALB request Count Per Target

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are your two options to autoscale at the EC2 instance level?

A

Autoscaling Group
ECS Cluster Capacity Provider (Preferred)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the two parameters you must set when configuring ECS Rolling Update

A

Min % and Max %

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Describe the “ECS tasks invoked by Event Bridge” architecture

A
  1. Setup a ECS cluster backed by Fargate.
  2. When an S3 bucket is written to, it writes to Amazon Eventbridge.
  3. Amazon EventBridge has a rull to Run ECS task for each event.
  4. ECS Task uses its role to access S3 and write the result to a target.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Suppose you want to be notified when an ECS task fails for some reason, what setup could you utalise?

A

When the ECS task exists, an event can be created in EventBridge that will trigger a SNS event to send an email.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are 7 primary fields in the ECS task Definition JSON document?

A
  1. Image Name
  2. Port Binding for Container and Host
  3. Memory and CPU required
  4. Environment variables
  5. Networking information
  6. IAM Roles
  7. Logging config
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

When running an ECS service with the EC2 task type, what much each underlying EC2 instance run?

A

The ECS agent

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How many containers can be defined in a single Task definition?

A

10

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

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?

A

Allow EC2 instances secrutiy group any port from the ALB’s security group

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

When using load balancing with Fargat, what port must you define (and which must you not).

A

Only define the container port, the host port is not applicable).

17
Q

How many task roles can be assigned per task definition

18
Q

When you have secret environment variables for ECS, where can you store them?

A
  • SSM Paramter Store
  • Secrets Manager
19
Q

When you need to share information between multiple containers in the same task definition, what would you use for EC2 and Fargate tasks respectively

A

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)

20
Q

Define the Binpack task placement strategy on ECS.

A

Places tasks based on the least available amount of CPU or memory

21
Q

Define the Spread task placement strategy on ECS

A

Distribute the tasks evenly across then instances

22
Q

What is the distinctInstance placement constraint?

A

Place each task on a difference container instance

23
Q

What is the memberOf placement constraint

A

Place task on instances that satisfy an expression written in cluster query language.

24
Q

In order to access ECR, what must be assigned to the EC2 instance?

25
What services does AWS copilot automate the deployment of?
ECS, VPC, ELB, ECR, etc
26
Where can AWS Copilot be deployed to?
ECS, Fargate, or App Runner
27
What is an alterntaive to ECS?
Amazon EKS (Elastic Kubernetes Service)
28
What are the two kinds of EKS nodes
Managed Node Self Manage NodesW
29
When a data volume is needed for EKS, what must you specify?
A storage class. Leverages a Container Storage Interface (CSI)
30
You have a Classic ECS cluster that you want to enable IAM roles for your ECS tasks so that they can make API requests to AWS services. Which ECS configuration option should you enable in /etc/ecs/ecs.config?
ECS_ENABLE_TASK_IAM_ROLE
31
When would you not define the Host port on a task definition
When you want to run multiple instances of the same task on a EC2 instance
32
You want to pull Docker images from a private ECR repository. Which AWS CLI command can you use?
aws ecr get-login-password | docker login | docker pull