-
-
Save leelu/ea9e9d60bfd0fd68a6c3f6faef9955b6 to your computer and use it in GitHub Desktop.
Hacky AWS ElastiCache Hourly Backup Shell Script
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 | |
| ## Requires AWS CLI Tools | |
| aws elasticache create-snapshot --cache-cluster-id redis-replica-1 --snapshot-name cg-backup-hourly-"$(date +"%Y-%m-%d-%H%M")" | |
| if [ $(aws elasticache describe-snapshots --cache-cluster-id redis-replica-1 |grep SnapshotName | wc -l) = "8" ]; then | |
| old_snapshot="$(aws elasticache describe-snapshots --cache-cluster-id redis-replica-1 |grep SnapshotName | head -1 | cut -d \" -f 4)" | |
| aws elasticache delete-snapshot --snapshot-name $old_snapshot | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment