Scale multiple ECS services at once
You use the following bash script I wrote to scale multiple ECS services at once:
- AWS CLI [1]
- An IAM account that has permission to update or scale ECS services
- A text file that contains all the ECS service names, each line contains 1 service name. For example:
service1
service2
...
./mass_scale_ecs_svc.sh <cluster name> <path to the ECS service names text file> <desired count, e.g., 0>
References:
[1] https://aws.amazon.com/cli/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# service_text_file is the path to a text file that contains a list of service names, each service name is on each line | |
cluster=$1 | |
service_text_file=$2 | |
desired_count=$3 | |
while IFS= read -r line | |
do | |
echo "$line" | |
aws ecs update-service --cluster "$cluster" --service "$line" --desired-count 0 >/dev/null 2>&1 | |
done < "$service_text_file" |
Prerequisite
- AWS CLI [1]
- An IAM account that has permission to update or scale ECS services
- A text file that contains all the ECS service names, each line contains 1 service name. For example:
service1
service2
...
Usage
./mass_scale_ecs_svc.sh <cluster name> <path to the ECS service names text file> <desired count, e.g., 0>
References:
[1] https://aws.amazon.com/cli/
Comments
Post a Comment