Simple BASH script for AWS S3
Closed - This job posting has been filled and work has been completed.
Im working with AWS s3, using s3cmd (google it) to manipulate s3 buckets and files.
We are currently using s3 to store our backups. I have a bash script in place to tgz our server files and upload them to s3.
I need a BASH script to go to the bucket, list the contents, and delete any backups that are 15 days or older.
With s3cmd you can list the current files in a bucket and there dates. IE:
# ./s3cmd ls s3://whatever
2012-10-23 16:00 3845651545 s3://whatever/server_data_20121023.
2012-10-24 14:35 3846660664 s3://whatever/server_data_20121024.
So im assuming you can sed out the date and compare it to the system time. But that's up to you.
For security reasons I can't give you access to our systems, so you will need to test this out on your own system.
Let me know if you have any questions.