Skip to content

Instantly share code, notes, and snippets.

@TETRA2000
Last active July 3, 2019 23:43
Show Gist options
  • Select an option

  • Save TETRA2000/f2b95b91e64865636baa83d4dcfb06e5 to your computer and use it in GitHub Desktop.

Select an option

Save TETRA2000/f2b95b91e64865636baa83d4dcfb06e5 to your computer and use it in GitHub Desktop.
AWS S3 Lifecycle Management

How to configure

You must enable versioning to use this configuration.

aws s3api put-bucket-lifecycle-configuration  \
--bucket bucket  \
--lifecycle-configuration file://config.json

See also

{
"Rules": [
{
"Expiration": {
"Days": 1
},
"ID": "ExpireFilesAtDocuments",
"Filter": {
"Prefix": "documents/"
},
"Status": "Enabled",
"NoncurrentVersionExpiration": {
"NoncurrentDays": 1
}
},
{
"ID": "ExpirePreviousVersions",
"Filter": {
"Prefix": ""
},
"Status": "Enabled",
"NoncurrentVersionExpiration": {
"NoncurrentDays": 1
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment