ECS - Elastic Container Service
What is Amazon Elastic Container Service?#
- Highly scalable and fast container management service
- Run, stop and manage containers on a cluster
- Containers are defined in a task definition, used to run an individual task or a task within a service
- A service is a configuration that lets you run a number of tasks simultaneously
- You can run your tasks and services on a serverless infrastructure that’s managed by AWS Fargate or on a a cluster of Amazon EC2 instances
- Integrated with Amazon Elastic Container Registry and Docker
- CI/CD: monitors changes to source dir, Builds new Docker image, pushes to container registry (ecr) and updates your ecs service to use the new image
- Supports service discovery
- Sending logs and metrics to Amazon Cloudwatch
Launch types#
- Fargate: pay-as-you-go containers without having to manage your infrastructure
- EC2: configure and deploy EC2 instances in your cluster
Fargate is better for large workloads requiring minimal overhead, small workloads with occasional bursts, tiny workloads and batch workloads. EC2 is better for workloads needing consistently high CPU and memory, large workloads optimised for price, access to persistent storage and cases where you must self-manage.
Management#
- AWS Management Console: web interface
- AWS Command Line Interface: CLI
- AWS SDKs: language-specific interfaces, eg. boto3 for Python
- AWS Copilot: open source tool for ECS
- Amazon ECS CLI - command line interface to Fargate and ECS - you can test locally or in the cloud
- AWS CDK - Amazon Cloud Development kit