Last active
August 29, 2015 14:06
-
-
Save Twinuma/c8f25aa4fcd26fc5af19 to your computer and use it in GitHub Desktop.
Revisions
-
Twinuma revised this gist
Sep 5, 2014 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -10,6 +10,7 @@ BACKUP_DATE=`date '+%Y%m%d'` rds-create-db-snapshot -i YOUR DBNAME -s backup-$BACKUP_DATE COUNT=0 # 世代をここで設定 MAX=3 for i in `rds-describe-db-snapshots | cut -f3 -d ' ' | sort -r` -
Twinuma created this gist
Sep 5, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ AWSAccessKeyId=your AccessKey AWSSecretKey=your SecretKey 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ #!/bin/sh -l export JAVA_HOME=/usr/lib/jvm/jre export AWS_BIN=/opt/aws/bin export PATH=$PATH:$EC2_HOME/bin:$AWS_BIN export EC2_REGION=ap-northeast-1 export AWS_CREDENTIAL_FILE=/opt/aws/rds/credential.txt BACKUP_DATE=`date '+%Y%m%d'` rds-create-db-snapshot -i YOUR DBNAME -s backup-$BACKUP_DATE COUNT=0 MAX=3 for i in `rds-describe-db-snapshots | cut -f3 -d ' ' | sort -r` do if [ $COUNT -ge $MAX ] then echo "DELETE:$i" rds-delete-db-snapshot $i -f fi COUNT=`expr $COUNT + 1` done