Module 9 - Containers Flashcards

1
Q

Why use microservices?

A

Loose coupling, autonomous development, faster development cycles, improve scalability/maintainability. Each microservice can be deployed autonomously. Each service is specialized (SRP). You can mix and match resources (e.g. Lambda for one, EC2 for another) or languages.

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

What are some ways to decouple components?

A

Load balancers, message queues.

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

What is AWS X-Ray?

A

A tracing service; good for debugging microservices. Provides an end-to-end view of requests as they travel through your stack, and shows a map of your application’s underlying components and their relationships.

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

What is a container?

A

A standard way to package your application’s code, configurations, and dependencies into a single object.

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

What is the difference between a container and a VM?

A

Containers share a machine’s OS system kernel, can share libraries. VMs each have their own full OS and libraries.

Containers don’t need Hypervisor, so no performance overhead. Can run on any system.

Containers are highly portable. You can also start and stop containers faster than VMs.

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

How can you run containers on AWS?

A

On top of EC2 instances with Docker.

ECS (Elastic Container Service)

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

What is ECS?

A

Elastic Container Service, a fully-managed container orchestration service that helps you easily deploy, manage, and scale containerized applications. Use Amazon ECS to run applications on a managed cluster of EC2 instances. After containers are launched, Amazon ECS will scale and manage your containers for you.

integrated with IAM. It supports Docker containers.

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

What is ECR?

A

Elastic Container Registry; a fully-managed Docker container registry that makes it easy to store, share, and deploy container IMAGES. It’s Docker Hub but for AWS. You can have public or private repositories.

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

What is EKS? What is the use case for it?

A

Elastic Kubernetes Service, a managed Kubernetes service that makes it easy for you to run Kubernetes on AWS and on-premises. EKS runs three Kubernetes managers across three Availability Zones.

Same launch types as ECS.

Load balancing with ALB, NLB, CLB.

Groups of containers are PODS.

It’s like ECS, but it’s 3rd party, open-source. ❗️Cloud agnostic.
• If an organization is using a 3rd party container orchestration platform, then you would use EKS so you don’t change the orchestration.
• ❗️Hybrid deployment (on-prem & cloud)
• batch processing, ML, WebApps

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

What are the basic components of Kubernetes architecture?

A

User Interfaces - dashboard or CLI

Control Plane - manages object states, responds to changes, and maintains a record of all objects.
• API server
• Scheduler (assigns pods to nodes)
• Controller-Manager (manages infrastructure)
• etcd component (stores configs)

Data Plane - CPU, memory, network, and storage
• Worker nodes in a pod
• Runtime engine
• kubelet runs containers in pods and runs health checks
• kube-proxy acts as a network proxy and load balancer for each node

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

What is Amazon Fargate?

A

A serverless, pay-as-you-go compute engine that lets you run containers without having to manage servers or clusters. Serverless containers.

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

What is an ECS task?

A

A running Docker container based on the info in the task definition.

A text file, in JSON format, that describes one or more containers, up to a maximum of ten, that form your application.

It tells ECS how to build your application:
• which images to pull from ECR or Docker Hub
• which launch type to use
• which ports should be opened
• what data volumes should be used
• how much CPU and RAM to use

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

What is an EC2 Launch Type?

A

When you launch Docker containers with this launch type, you launch an ECS task on an ECS cluster of EC2 instances. You need to provision and maintain the cluster of EC2 instances yourself in advance.

Each EC2 runs the ECS agent which registers the EC2 in the cluster. Then AWS takes over and starts and stops containers in those specified EC2s.

You pay per EC2, not per task/container.

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

What is the FarGate launch type?

A

You do not have to provision and manage the EC2 instances yourself. It’s all serverless.

You specify the task definitions, and AWS runs them based on the CPU/RAM you need.

To scale, just increase the number of tasks (using the ECS service). You don’t need to worry about the EC2 instances.

Pay per running task.

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

With an EC2 launch type, how do IAM roles work?

A

The EC2 has an instance profile/role (used by the agent on the machine). The agent uses the instance profile to connect to ECS, ECR, CloudWatch, etc.; i.e.
❗️permissions for the HOST.

The individual tasks running on the instance can each have an IAM TASK ROLE. Each role lets you connect to different services as needed. The ROLE is defined in the TASK definition.
❗️permissions for the CONTAINER.

✅ Roles for the instance will carry over to the tasks running on that instance. If you have different containers that need different permissions, use TASK roles.

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

I want to expose the ECS tasks as endpoints. How do I do that?

A

Put them behind an application load balancer.

17
Q

How do you handle data persistence in ECS?

A

EFS is compatible with EC2 & Fargate launch types. You can mount the file system onto the tasks.

EFS + Fargate = serverless.

❗️FSx for Lustre & Windows NOT supported
❗️S3 can NOT be mounted as a file system

18
Q

What is an ECS service?

A

A way to specify the number of tasks we want to run. Auto-scaling for tasks, can attach ELB. If you auto-scale, the service knows an EC2 instance is being attached to a cluster and can launch tasks on it.

19
Q

What is an ECS cluster?

A

A logical grouping of EC2 instances that run your containers/tasks.

20
Q

What is a Task Definition?

A

A blueprint that describes how a Docker container should launch and all the configuration information.

21
Q

What is the difference between EC2 launch type and Fargate launch type with regard to storage?

A

EC2:
• Docker volumes (which connects to external volumes like EBS)
• EFS
• FSx for windows

Fargate: EFS only.

22
Q

How do IAM roles work with the Fargate launch type?

A

Only task roles can be applied. There is no instance role.

23
Q

What types of scaling are there for ECS?

A

Service autoscaling:
• uses the Application AutoScaling Service to adjust the task count.
• TASK LEVEL
• target tracking, step, scheduled scaling policies
• tracks ECS service CPU, ECS Service memory, ALB request count

⭐️ Cluster autoscaling:
• uses a Capacity Provider (associated with ASG) to scale the # of cluster instances using EC2 auto-scaling.
• INSTANCE LEVEL
• ASG will scale using managed scaling and instance termination protection (it knows if a task is still running)

24
Q

What is container awareness?

A

The ALB has container awareness, i.e. it knows about dynamic host ports so when a request comes in for port 80, it can direct to the correct dynamic port.

Then the host/instance knows that any request to the dynamic port should be forwarded to a specific task running on that instance.