phpbu
phpbu copied to clipboard
Amazon S3 Lifecycle
This is about the deleting backups after x days/months remotley (on Amazon S3).
https://docs.aws.amazon.com/AmazonS3/latest/dev/lifecycle-expire-general-considerations.html
Sebastian, any ideas how to implement it?
Hi,
right now phpbu doesn't create Buckets
, phpbu assumes that the bucket you configure already exists and if not the upload will fail. Since the TTL is a bucket-setting you can update its settings via API oder Management Console.
Have a look at this aws blog post. https://aws.amazon.com/de/blogs/aws/amazon-s3-object-expiration/
Hope that helps. Cheers, Sebastian
would be nice to automagically create the bucket and set the expiration date according to the cleanup functionality.
Yes adding an option to create the bucket if it doesn't exist would be nice.
But I think there should be separate sync options to configure the bucket expiration settings.
Firstly because remote and local cleanup should be separated and secondly because the bucket doesn't support "all" possible cleanup strategies and this would imply that all Sync
implementations would support this, which they do not ;)
Maybe something like this
<option name="bucket.create" value="true"/>
<option name="bucket.ttl" value="2m"/>
The bucket create feature is now in dev-master
I couldn't get the TTL thing to work. The S3 API does not accept the rules I'm trying to create for new buckets :/
In the case this does not work, a nice idea would be implementing a json store file something like composer.lock that would store local backups, hashes, remote backups, size, date time, etc. and maybe use that to delete remote files.
The crazy thing is there should be a way to set the bucket rules with the AWS SDK, but I could not get it to work. Sadly, for now, I did not find the time to investigate this further or try to find any working code examples.
The sweet thing about your idea is, that we could use it for every cloud storage integration.
I am using the lifecycle just activating versioning and saving the file without the date and the time, this way Amazon understand is a new version automatically. In case it helps to others.