Created
November 8, 2014 23:14
-
-
Save hawaku/d226ee146ff92a1067b7 to your computer and use it in GitHub Desktop.
AWS RDSの情報をAWS CLIで一括取得する ref: http://qiita.com/treeclad/items/312657d3da34b69926b7
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
#/bin/bash | |
# --profileで指定するプロファイル名 | |
profile_list=`cat ~/.aws/config |grep profile|cut -d ' ' -f 2|sed 's/]//'` | |
for profile in ${profile_list[@]} | |
do | |
region_list=`aws --profile ${profile} ec2 describe-regions|jq -r '.Regions[].RegionName'` | |
for region in ${region_list[@]} | |
do | |
echo "===== Profile:${profile} Region:${region}" | |
rds_list=`aws --profile ${profile} --region ${region} rds describe-db-instances\ | |
|jq -r '.DBInstances[]|.DBInstanceIdentifier'` | |
for rds in ${rds_list[@]} | |
do | |
result=`aws --profile ${profile} --region ${region} rds describe-db-instances \ | |
--db-instance-identifier ${rds} \ | |
|jq -r '.DBInstances[]|{"AutoMinorVersionUpgrade","PreferredMaintenanceWindow","PreferredBackupWindow","EngineVersion","AvailabilityZone","DBInstanceIdentifier"}'` | |
echo "${result}" | |
done | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment