s3tools/s3cmd — pull request #295 by hrchu (2014-03-09 14:44:44+00:00)
Title: Support for object expiration

The design is neither powerful nor flexiable as bucket lifecycle APIs, but straightforward and easy to use in CLI. Glacier is not supported.

One command: 'expire', and three options '--expiry-prefix', '--expiry-days', '--expiry-date' are new.

You can create or update expiration rule, e.g.,
s3cmd expire s3://[bucket] --expiry-days=365 --expiry-prefix=log/
s3cmd expire s3://[bucket] --expiry-date=2012-12-31T00:00:00.000Z --expiry-prefix=log/

If --exipry-prefix is not given, the expiration rule is applied to all objects in the bucket by default:
s3cmd expire s3://[bucket] --expiry-days=365
s3cmd expire s3://[bucket] --expiry-date=2012-12-31T00:00:00.000Z

You cannot spcifiy both --expiry-days amd --expiry-date at the same time, or the error is occurred:
ERROR: Parameter problem: Expect either --expiry-day or --expiry-date

You can get current expiration setting by the info command:
s3cmd info s3://[bucket]

You can delete expiration rule by executing expire command without any expiry-* options:
s3cmd expire s3://[bucket]

This just work fine for me.
Let me know if you have any questions or suggestions on this.