Created
August 4, 2017 03:21
-
-
Save tkuchiki/3c642f2ba3eafdeea67264f8f7190ca6 to your computer and use it in GitHub Desktop.
Aurora Writer のインスタンスサイズを変更した後、もう一度 Writer にする
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 | |
set -u | |
INSTANCE="${1}" | |
SIZE="${2}" | |
CLUSTER="${3}" | |
echo "modify db instance: ${INSTANCE} ${SIZE}" | |
aws rds modify-db-instance --db-instance-identifier ${INSTANCE} --db-instance-class ${SIZE} --apply-immediately | |
# modify-db-instance 直後にステータスを見ると available になるので sleep する | |
sleep 300 | |
while :; do | |
status=$(aws rds describe-db-instances --db-instance-identifier ${INSTANCE} | jq -r .DBInstances[].DBInstanceStatus) | |
[ "${status}" = "available" ] && break | |
echo -ne "." | |
sleep 60 | |
done | |
echo "modified db instance: ${INSTANCE} ${SIZE}" | |
aws rds failover-db-cluster --db-cluster-identifier ${CLUSTER} --target-db-instance-identifier ${INSTANCE} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment