I have written a script which takes MySQL dumps and uploads it to Amazon S3. I have added the script to the cronjob and it runs at 2 o'clock in the midnight 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 backups 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.