Skip to content

Instantly share code, notes, and snippets.

@hawaku
Created November 8, 2014 23:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hawaku/d226ee146ff92a1067b7 to your computer and use it in GitHub Desktop.
Save hawaku/d226ee146ff92a1067b7 to your computer and use it in GitHub Desktop.
AWS RDSの情報をAWS CLIで一括取得する ref: http://qiita.com/treeclad/items/312657d3da34b69926b7
#/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