Amazon ECS - keshavbaweja-git/guides GitHub Wiki
Clusters
- Clusters are region specific.
- A cluster may contain mix of tasks hosted on different launch types.
- ECS Launch Types - Fargate, EC2, External
Capacity Providers
- A cluster may contain mix of both Auto Scaling and Fargate capacity providers
- A capacity provider strategy can include only one type of capacity provider.
- FARGATE and FARGATE_SPOT are reserved capacity providers that can be associated with your ECS cluster
- EC2 Capacity Provider
- Name
- Auto Scaling Group
- Managed scaling and termination settings
- A capacity provider strategy is specified when creating a service or running a task
- A default capacity provider strategy is associated with a cluster.
- A service may be updated to use a capacity provider strategy rather than a launch type.
Fargate capacity provider
- Not supported for Windows containers and Linux arm64 architectures
- Reserved capacity providers that can be associated/disassociated from a cluster
- When tasks are stopped, event notification is sent to Amazon EventBridge.
- When tasks are stopped due to Spot interruption, a two minute warning is sent before the task is stopped. SIGTERM is sent to container and a task state change event is sent to EventBridge. ECS
stopTimeout
has a default value of 30 seconds.
Networking
- AWSVPC mode
- Bridge mode
- Host mode
https://docs.aws.amazon.com/AmazonECS/latest/bestpracticesguide/networking-networkmode.html
FireLens
- FireLens can route logs to AWS services and APN services as destination for log storage. FireLens provides an abstraction for Fluentd and Fluent Bit.
Sensitive data
- ECS offers seamless integration with Secrets Manager and SSM Parameter Store for accessing sensitive data, which can be injected as environment variables in containers or in task definition attributes.
IAM roles
- Execution Role - IAM role for ECS agent
- Task Role - IAM role for ECS task
- Container Instance Role - ecsInstanceRole (service role)
ECS Account level settings
- CloudWatch Container Insights
- AWS VPC Trunking
- Dual Stack
Service scheduler strategies
- REPLICA
- DAEMON (not supported for Fargate launch type)
- EventBridge scheduled event
Task placement strategies
- binpack
- random
- spread
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-strategies.html
Task placement constraints
- distinctInstance
- memberOf
- ecs.os-family
Deployment - Rolling update
- Currently running tasks are replaced with new tasks
- minimumHealthyPercent - lower limit on no. of tasks that should be running during a deployment, expressed in percentage
- maximumPercent - upper limit on number of tasks that should be running during a service deployment
- Supports deployment circuit breaker - Can't be used with Classic LB, is not triggered if service deployment has at least one successfully running task.
Deployment - Blue/Green
- Canary - two increments
- Linear - equal increments with equal interval between increments
- All at once
Application Auto Scaling
- ECS Service can be configured as "AWS::ApplicationAutoScaling::ScalableTarget"
- "AWS::ApplicationAutoScaling::ScalingPolicy" allows a Target Tracking or Step Scaling policy to be associated with a scalable target