diff --git a/s3-config/README.md b/s3-config/README.md new file mode 100644 index 000000000..38a1c9aae --- /dev/null +++ b/s3-config/README.md @@ -0,0 +1,14 @@ +# AWS configuration + +## Lifecycle rules +S3 lifecycle rules help to keep the S3 buckets free from cruft, from files that have been deleted, many versions of files, and old log files. The files in this directory can be applied to S3 using the aws command line client. The files are specific for staging and production data storage and log file storage. + +``` +aws s3api put-bucket-lifecycle-configuration --bucket --lifecycle-configuration file://.json +``` + +You can check what rules are already applied to a bucket running + +``` +aws s3api get-bucket-lifecycle-configuration --bucket +``` \ No newline at end of file diff --git a/s3-config/logs-lifecycle.json b/s3-config/logs-lifecycle.json new file mode 100644 index 000000000..74b842e9a --- /dev/null +++ b/s3-config/logs-lifecycle.json @@ -0,0 +1,12 @@ +{ + "Rules": [ + { + "Expiration": { + "Days": 60 + }, + "ID": "delete old logs", + "Filter": {}, + "Status": "Enabled" + } + ] +} diff --git a/s3-config/prod-lifecycle.json b/s3-config/prod-lifecycle.json new file mode 100644 index 000000000..d3532a453 --- /dev/null +++ b/s3-config/prod-lifecycle.json @@ -0,0 +1,18 @@ +{ + "Rules": [ + { + "Expiration": { + "ExpiredObjectDeleteMarker": true + }, + "ID": "Remove old deleted versions", + "Filter": {}, + "Status": "Enabled", + "NoncurrentVersionExpiration": { + "NoncurrentDays": 30 + }, + "AbortIncompleteMultipartUpload": { + "DaysAfterInitiation": 14 + } + } + ] +} diff --git a/s3-config/staging-lifecycle.json b/s3-config/staging-lifecycle.json new file mode 100644 index 000000000..d3532a453 --- /dev/null +++ b/s3-config/staging-lifecycle.json @@ -0,0 +1,18 @@ +{ + "Rules": [ + { + "Expiration": { + "ExpiredObjectDeleteMarker": true + }, + "ID": "Remove old deleted versions", + "Filter": {}, + "Status": "Enabled", + "NoncurrentVersionExpiration": { + "NoncurrentDays": 30 + }, + "AbortIncompleteMultipartUpload": { + "DaysAfterInitiation": 14 + } + } + ] +}