Implementing an ECS Auto Scaling solution
Now that you have a good understanding of how to calculate the ECS cluster capacity for the purposes of making scale-out and scale-in decisions, we are ready to implement an auto scaling solution, as illustrated in the following diagram:
The following provides a walkthrough of the solution shown in the preceding diagram:
- Before you calculate the ECS cluster capacity, you need a mechanism that will trigger calculations of capacity, ideally whenever the capacity of your ECS container instances changes. This can be achieved by leveraging the CloudWatch Events service, which publishes events for various AWS services including ECS, and allows you to create event rules that subscribe to specific events and process them using a variety of mechanisms, including a Lambda function. CloudWatch events support receiving information about ECS container-instance state changes, and this represents the ideal mechanism for triggering cluster capacity calculations, as...