- Created one folder s3-mp and set up the path to work on AWS cli
- Created one file called lifecycle-config.json to create a lifecycle rule
{
“Rules”: [
{
“ID”: “AbortIncompleteMultipartUpload”,
“Status”: “Enabled”,
“Filter”: {},
“AbortIncompleteMultipartUpload”: {
“DaysAfterInitiation”: 7
}
}
]
}
- Called that file in each bucket using For loop script.
- For bucket in $(aws s3api list-buckets –query ‘Bucket[].Name’ –output text);
do
echo “Processing $bucket…”
aws s3api put-bucket-lifecycle-configuration\
–bucket “$bucket”\
–lifecycle-configuration file://lifecycle-config.json
done
- Change each environment keys and ran the script for all the accounts.
Leave a Reply