aws-all
is a command that allows you to execute AWS CLI commands across multiple AWS profiles and regions.
aws-all
iterates over a list of AWS profiles and regions, executing a specified AWS CLI command in each combination. The output is structured in a JSON or text format.
For JSON output:
{
"region": "us-east-1",
"profile": "master",
"output": []
}
For text output:
Region: us-east-1
Profile: master
Output:
---
aws-all --profiles "profile1 profile2" --regions "us-east-1 us-east-2" -- <aws-cli-command>
Replace <aws-cli-command>
with the AWS CLI command you want to execute.
Example:
aws-all --profiles "profile1 profile2" --regions "us-east-1 ap-northeast-1" -- ec2 describe-availability-zones --query 'AvailabilityZones[].ZoneName'
{
"region": "us-east-1",
"profile": "profile1",
"output": [
"us-east-1a",
"us-east-1b",
"us-east-1c",
"us-east-1d",
"us-east-1e",
"us-east-1f"
]
}
{
"region": "ap-northeast-1",
"profile": "profile1",
"output": [
"ap-northeast-1a",
"ap-northeast-1c",
"ap-northeast-1d"
]
}
...
You can specify profiles and regions using environment variables.
export AWS_PROFILES="profile1 profile2"
export AWS_REGIONS="us-east-1 us-east-2"
aws-all -- <aws-cli-command>
You can specify the output format using the --output
option. The available formats are json
and text
. By default, the output format is json
.
-
Download the
aws-all
command to your local machine. -
Make the command executable:
chmod +x aws-all
- Move the script to a directory in your PATH:
mv aws-all /usr/local/bin
This project is licensed under the MIT License. See the LICENSE file for details.