Notes on: Linux Academy: AWS CSAA: 19) EC2 Container Service

Just a place to put some notes on the “AWS Certified Solutions Architect - Associate (New!)” course from https://linuxacademy.com

EC2 Container Service (ECS)

Image: Architecture: ECS

EC2 Container Service (ECS) Essentials:

- ECS is a container management service that supports Docker
- It allows you to easily create and manage a fleet of Docker containers on a cluster of EC2 instances

Why use ECS/Containers?

Create distributed applications and Microservices:
- Create application architecture comprised of independent tasks or processes (microservices)
- For example, you can have separate containers for various components of your application
-- Webserver
-- Application server
-- Message queue
-- Backend Servers
- This allows you to start, stop, manage, monitor, and scale each container independently

Batch and ETL Jobs:
- Package batch and ETL jobs into containers and deploy them into a shared EC2 cluster(s)
- Run different versions of the same job or multiple jobs on the same cluster
- Share cluster capacity with other processes and or grow job dynamically on-demand to improve resource utilization

Continuous Integration and Deployment:
- By using Docker's Image versioning, you can use containers for continuous integration and deployment
- Build processes can pull, build, and create a Docker Image that can be deployed into your containers
- This allows you to avoid an application from working in a developer environment and not working in a production environment because the Docker daemon is the same across all environments

Dockerfile:

- A plain text file (script) that specifies all of the components that are included in the container
- Basically, it’s the instructions for what will be placed inside a given container

Container/Docker Image:

- A container/Docker image is built from a Dockerfile
- The container/Docker image contains all the downloaded software, code, runtime, system tools, and libraries (as outlined in the Dockerfile)
-- i.e. If the Dockerfile specifies PHP to be downloaded and installed, then the container/Docker Image will have PHP downloaded and installed

Container Registry:

- A container registry is a repository where container/docker images are stored and accessed from when needed
- A container registry can be:
-- Located on AWS via the ECR service (EC2 Container Registry)
-- A 3rd party repository like Docker Hub
-- Self-hosted registry

ECS Task Definition:

- A JSON formatted text file that contains the “blueprint” for your application, including:
-- Which container/docker image to use
-- The repository (container registry) the image is located in
-- Which ports should be open on the container instance
-- What data volumes should be used with the containers

ECS Agent:

- The ECS Agent runs on each EC2 instance in the ECS cluster
- It communicates information about the instances to EC2, including:
-- Running tasks
-- Resource Utilization
- The ECS Agent is also responsible for starting/stopping tasks (when told to by ECS)

ECS Task:

- An ECS Task is the actual representation of the Task Definition on an EC2 instance inside of your container cluster
- The ECS Agent will start/stop these tasks based on instruction/schedule

Quiz: ECS Basics Quiz

Q: Which of the following is NOT a use case for using ECS?
A: Cache big data queries
E: Cache big data queries is best done with a service like Elasticache, not ECS.

Q: What is responsible for starting and stopping tasks on an ECS Container instance.
A: ECS Agent
E: The ECS Agent is responsible for starting/stopping tasks. It also monitors tasks and resource utilization.

Q: What two components does a Task Definition define?
A1: Which ports should be open on the container instance
A2: Which container image to use
E: The Task Definition is the blueprint for your application and defines items such as: 1) Which ports should be open on the container instance 2) Which container image to use 3) Where to get the container image 4) What data volumes to use.

Q: What is the purpose of AWS ECR?
A: To act as a container registry service
E: ECR is short for EC2 Container Registry. It is a repository service for storing container images.

Q: What component ECS/Containers contains all the actual software, code, and system tools that your container will use?
A: Container/Docker Image
E: The Container/Docker Image, which is built from the Dockerfile, contains all the actual software, code, runtime, system tools, and libraries that will be used in the container.

Comments