ECS, ECR & Fargate - Docker in AWS Flashcards
What is Docker?
A software development platform to deploy apps
How does Docker work?
Packages apps in containers that can be run on any OS
Two types of Docker Repositories?
- Docker Hub (public repo)
- Amazon ECR (amazon docker repo)
Where are Docker images stored?
Docker Repositories
What is Amazon ECR?
Amazon Elastic Container Registry
Amazon’s own container platform?
Amazon Elastic Container Service (Amazon ECS)
Amazon’s managed Kubernetes (open source)?
Amazon Elastic Kubernetes Service (Amazon EKS)
What is Amazon’s own Serverless container platform and works with ECS and with EKS?
AWS Fargate
Amazon service that stores container images
Amazon ECR
How do you launch Docker containers using EC2 Launch Type in Amazon ECS?
Launch ECS tasks on an ECS cluster with EC2 instances.
Each EC2 Instance ….. the ….. to register in the ECS Cluster
must run, ECS Agent
When must you provision & maintain the infrastructure (the EC2 instances)
When running ECS with a EC2 Launch type.
When running EC2 launch type on ECS what will AWS take care of?
starting / stopping container
What is a launch type?
A configuration that determines how your Docker containers are deployed and ran.
What does Amazon Elastic Container Service do?
Orchestrates container deployment, and launch types specify the underlying infrastructure used by ECS to run those containers.
How do you launch Docker containers using Fargate Launch Type in Amazon ECS?
It’s serverless, no need to provision infrastructure.
You just create task definitions
When running Fargate launch type on ECS what will AWS take care of?
AWS just runs ECS Tasks for you based on the CPU / RAM you need
How can you scale your Fargate launch Type containers?
Just increase the number of tasks.
Features:
- Used by the ECS agent
- Makes API calls to ECS service
- Send container logs to CloudWatch Logs
- Pull Docker image from ECR
- Reference sensitive data in Secrets Manager or SSM Parameter Store
EC2 Instance Profile (EC2 Launch Type only)
Features:
- Allows each task to have a specific role
- Use different roles for the different ECS Services you run
- Task Role is defined in the task definition
ECSTask Role
Which ELB is supported and works for most use cases in Amazon ECS
Application Load Balancer
Which ELB is recommended only for high throughput / high performance use cases, or to pair it with AWS Private Link in Amazon ECS
Network Load Balancer
Can you mount EFS file systems onto ECS tasks?
Yes
Can Amazon S3 be mounted as a file system?
No
What does Amazon ECS Auto Scaling use?
AWS Application Auto Scaling
What does ECS Service Auto Scaling do?
Automatically increase/decrease the desired number of ECS tasks
ECS Service Auto Scaling = EC2 Auto Scaling
False.
ECS - task level
EC2 - instance level
Features:
- ECS Service Average CPU Utilization
- ECS Service Average Memory Utilization - Scale on RAM
- ALB Request Count Per Target – metric coming from the ALB
AWS Application Auto Scaling
How can you accommodate ECS Service Scaling?
Add underlying EC2 instances
What is Auto Scaling Group Scaling?
- Scale your ASG based on CPU Utilization
- Add EC2 instances over time
What is ECS Cluster Capacity Provider?
- Used to automatically provision and scale the infrastructure for your ECS Tasks
-Add EC2 Instances when you’re missing capacity (CPU, RAM…)
What is a Capacity Provider paired with an Auto Scaling Group?
ECS Cluster Capacity Provider
How does ECS rolling updates work?
When updating from v1 to v2, we can control how many tasks can be started
and stopped, and in which order
What is an Amazon ECS “Task Definition”?
Metadata in JSON form to tell ECS how to run a Docker container
contains crucial information:
- Image Name
- Port Binding for Container and Host
- Memory and CPU required
- Environment variables
- Networking information
- IAM Role
- Logging configuration (ex CloudWatch)
Task Definitions
How can you share data between multiple containers in the same Task Definition?
Data Volumes (Bind Mounts)
What kind of data do EC2Tasks use?
EC2 instance storage
When using EC2 instance data volume to what is the data are tied to?
Lifecycle of the EC2 instance
What kind of data do Fargate Tasks use?
Ephemeral storage
When an ECS task is started with EC2 Launch Type, ECS must determine where to……., with the constraints of …… and ……..
place it, CPU, memory (RAM)
When using Fargate Tasks data volume to what is the data are tied to?
The container using them.
When a service scales in, ECS needs to……. which task to……
determine, terminate
- Identify which instances that satisfy the CPU, memory, and port requirements - Identify which instances that satisfy the Task Placement Constraints - Identify which instances that satisfy the Task Placement Strategies - Select the instances
The process to select the appropriate EC2 Container instance when Amazon ECS places a task
Features:
- Binpack
- Random
- Spread
- You can mix them together
Task Placement Strategies
What are two Task Placement Constraints?
- distinctInstance
- memberOf
Task Placement Constraints
- distinctInstance
Tasks are placed on a different EC2 instance
Task Placement Constraints
- memberOf
- Tasks are placed on EC2 instances that satisfy a specified expression
- Uses the Cluster Query Language (advanced)
What is Amazon ECR?
Elastic Container Registry
What does Amazon ECR do?
Store and manage Docker images on AWS
What does AWS Copilot do?
CLI tool to build, release, and operate production-ready containerized apps
Features:
- Run your apps on AppRunner, ECS, and Fargate
- Helps you focus on building apps rather than setting up infrastructure
- Automated deployments with one command using CodePipeline
- Deploy to multiple environments
- Troubleshooting, logs, health status…
AWS Copilot
What is Amazon EKS?
Amazon Elastic Kubernetes Service
What does Elastic Kubernetes Service do?
It is a way to launch managed Kubernetes clusters on AWS
What is Kubernates?
an open-source system for automatic deployment, scaling and management of containerized (usually Docker) application
How can you deploy workers nodes or serverless containers on with EKS?
EC2 for worker nodes
Fargate for serverless containers
How can you run EKS on multiple regions?
Deploy on EKS cluster per region.
Amazon EKS – Node Types?
- Managed Node Groups
- Self-Managed Nodes
- AWS Fargate
Node Types:
No maintenance required; no nodes managed
AWS Fargate
Node Types:
- Nodes created by you and registered to the EKS cluster and managed by an ASG
- You can use prebuilt AMI - Amazon EKS Optimized AMI
- Supports On-Demand or Spot Instances
- Self-Managed Nodes
Node Types:
- Creates and manages Nodes (EC2 instances) for you
- Nodes are part of an ASG managed by EKS
- Supports On-Demand or Spot Instances
Managed Node Groups
Need to specify….. manifest on your EKS cluster
StorageClass