AWS Lambda to update the 'desired count' of an ECS service.
Clone the repository and install the Serverless plugins.
git clone https://github.com/theuves/ecs-desired-count.git
cd ecs-desired-count
npm install
Create a .env
file with the following environment variables:
REGION
- AWS region where the lambda will be deployed (e.g.us-east-1
)ECS_CLUSTER
- cluster nameECS_SERVICE
- service nameCOUNT_ORDER
- list of desired counts separated by commas (e.g.0,1
)
If the value of COUNT_ORDER
is 2,4,6
and the current desired count is 2 then the desired count will be 4 on the first run, 6 on the second, 2 on the third and so on.
serverless deploy
Use the serverless remove
command to remove Serverless service.
MIT © Matheus Alves