1

I've been searching for an answer to this question for quite some time but apparently I'm missing something.

I use s3cmd heavily to automate document uploads to AWS S3, via script. One of the parameters that can be used in s3cmd is --add-header, which I assume allows for lifecycle rules to be added.

My objective is to add this parameters and specify a +X (where X is days) to the upload. In the event of ... --add-header=...1 ... the lifecyle rule would delete this file after 24h.

I know this can be easily done via the console, but I would like to have a more detailed control over individual files/scripts.

I've read the parameters that can be passed to S3 via s3cmd, but I somehow can't understand how to put all of those together to get the intended result.

Thank you very much for any help or assistance!

t988GF
  • 183
  • 7

1 Answers1

0

The S3 API itself does not implement support for any request header that triggers lifecycle management at the object level.

The --add-header option for s3cmd can add headers that S3 understands, such as Content-Type, but there is no lifecycle header you can send using any tool.

You might be thinking of this:

If you make a GET or a HEAD request on an object that has been scheduled for expiration, the response will include an x-amz-expiration header that includes this expiration date and the corresponding rule Id

https://aws.amazon.com/blogs/aws/amazon-s3-object-expiration/

This is a reaponse header, and is read-only.

Michael - sqlbot
  • 169,571
  • 25
  • 353
  • 427