I have written a script which takes mysql dumps and uploads it to s3 and I have added the script to the cronjob and script runs at 2 o clock in the mid night and uploads the mysql dump to S3. I am using the date and time stamp as the file name before uploading it to S3.
My problem is I need to manage back ups of 7 days on S3 and automatically I have to delete the 8th day backup file from S3 since I am using the date and Time stamp as file name to make each file unique, I am not able to figure out how to do it.
And also I have to restore the latest backup in another EC2 instance.
You can grab the XML response from your S3 bucket host, such as
It should return a XML like :-
And with the value from LastModified node, you can determine when the file is created.
S3 has SDK api available is different languages,
you can download a copy then programmatically do the purging
As for replicating, with the SDK api, you can grab the content from original S3 bucket then post it to another S3 bucket.
SDK Api:-
http://aws.amazon.com/sdkforphp/ (PHP)
http://aws.amazon.com/sdkfornet/ (.Net)
http://aws.amazon.com/sdkforjava/ (Java)