Skip to content

Instantly share code, notes, and snippets.

@leelu
Forked from luckyjajj/elasticache_backup.sh
Created September 24, 2018 15:01
Show Gist options
  • Select an option

  • Save leelu/ea9e9d60bfd0fd68a6c3f6faef9955b6 to your computer and use it in GitHub Desktop.

Select an option

Save leelu/ea9e9d60bfd0fd68a6c3f6faef9955b6 to your computer and use it in GitHub Desktop.

Revisions

  1. @luckyjajj luckyjajj revised this gist Dec 4, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions elasticache_backup.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    #!/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
  2. @luckyjajj luckyjajj created this gist Dec 4, 2015.
    8 changes: 8 additions & 0 deletions elasticache_backup.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    #!/bin/bash

    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