这是一个方便的小php脚本,我曾经使用版本控制从备份存储桶中还原存储桶:
在启用版本控制的情况下运行到存储桶中
#CONFIGURATION
export bucket_to_backup='example-of-a-bucket-name';
export backup_bucket='example-of-a-backup-bucket-name';
export AWS_ACCESS_KEY_ID=ASDFDSAFADSFDASF;
export AWS_SECRET_ACCESS_KEY=adsfdsaf86adsf5adsf568aadf75ads;
#you will need to download and install the s3cmd tool at the following url:
#http://s3tools.org/
s3cmd --access_key=$AWS_ACCESS_KEY_ID --secret_key=$AWS_SECRET_ACCESS_KEY --recursive sync s3://$bucket_to_backup s3://$backup_bucket;
从这两个时间戳之间版本控制的文件中恢复备份
export startSnapShotTimeStamp=1427577934;
export endSnapShotTimeStamp=1427577939;
#do the restore with php script
php awsUtil.php sync example-of-a-backup-bucket-name example-of-a-bucket-name $startSnapShotTimeStamp-$endSnapShotTimeStamp
您可以在此处下载PHP脚本:http :
//boulderapps.co/post/backing-up-and-restoring-s3-to-a-versioned-bucket