Ensure that your Amazon Elastic Container Service (ECS) cluster services are using the best placement strategies in order to optimize tasks for reliability and cost efficiency. A placement strategy is an algorithm for selecting EC2 instances for task placement or tasks for termination. The recommended task placement strategies for your Amazon ECS services are "Spread" and "Binpack". The "Spread" placement strategy will ensure that your tasks are placed evenly based on the specified value, providing redundancy within the ECS service and thus better reliability. The "Binpack" strategy places tasks on container instances so as to leave the least amount of unused memory or CPU (but still able to run the tasks). This strategy minimizes the number of Amazon ECS container instances in use, resulting in cost efficiency.
This rule resolution is part of the Conformity Security & Compliance tool for AWS.
optimisation
When a task that uses the EC2 launch type is executed, Amazon ECS must determine where to place that task based on the requirements specified in the task definition, such as CPU and memory. Similarly, when you scale down the task count, Amazon ECS must determine which tasks to terminate. To customize how Amazon ECS service places and terminates tasks for improved reliability and cost efficiency, apply the recommended task placement strategies.
Audit
To determine the task placement strategy defined for your Amazon ECS cluster service(s), perform the following actions:
Remediation / Resolution
To configure the compliant (optimal) task placement strategy for your Amazon ECS cluster services, perform the following actions:
References
- AWS Documentation
- Amazon Elastic Container Service FAQs
- Amazon ECS task placement
- Amazon ECS task placement strategies
- Service definition parameters
- AWS Command Line Interface (CLI) Documentation
- ecs
- list-clusters
- list-services
- describe-services
- update-service