Created
September 30, 2019 09:14
-
-
Save BrunIF/95213ad1c3bf8bca75ca40ae8a6ca3c5 to your computer and use it in GitHub Desktop.
Create AWS RDS Sanpshot with waiting
This file contains hidden or 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 | |
# Needed sftware: awscli, jq | |
DATE=$(date +%Y%m%d-%H%M%S) | |
DB_IDENTIFIER="mysql" | |
SS=$(aws rds create-db-snapshot --db-snapshot-identifier ${DB_IDENTIFIER}-${DATE} --db-instance-identifier ${DB_IDENTIFIER} | jq -r .DBSnapshot.DBSnapshotArn) | |
DB_STATUS="" | |
while [[ "$DB_STATUS" != "available" ]] | |
do | |
echo -ne "." | |
sleep 1 | |
DB_STATUS=$(aws rds describe-db-snapshots --db-snapshot-identifier $SS | jq -r ".DBSnapshots[0].Status") | |
done | |
echo | |
echo "DB Snapshot ${SS} is created" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment