Skip to content

Instantly share code, notes, and snippets.

@BrunIF
Created September 30, 2019 09:14
Show Gist options
  • Save BrunIF/95213ad1c3bf8bca75ca40ae8a6ca3c5 to your computer and use it in GitHub Desktop.
Save BrunIF/95213ad1c3bf8bca75ca40ae8a6ca3c5 to your computer and use it in GitHub Desktop.
Create AWS RDS Sanpshot with waiting
#!/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