Last active
June 6, 2024 16:29
-
-
Save ragul28/093810cc56d77d2a7c14f72b74d6c710 to your computer and use it in GitHub Desktop.
Run aws command on all regions
This file contains 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
function awsall { | |
export AWS_PAGER="" | |
for i in `aws ec2 describe-regions --query "Regions[].{Name:RegionName}" --output text|sort -r` | |
do | |
echo "------" | |
echo $i | |
echo "------" | |
echo -e "\n" | |
if [ `echo "$@"|grep -i '\-\-region'|wc -l` -eq 1 ] | |
then | |
echo "You cannot use – region flag while using awsall" | |
break | |
fi | |
aws $@ – region $i | |
sleep 2 | |
done | |
trap "break" INT TERM | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think you have a bug in the script where the instances of
--
have been replaced with an EN DASH character. Putting back the double hyphens worked for me.