Skip to content

Commit 3536978

Browse files
committed
[Update] - add instruction for remove s3 versioning enabled
1 parent f719d19 commit 3536978

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

services/s3.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,26 @@ aws_s3_rm_instruction() {
8888
aws_s3_ls
8989
]
9090
"
91+
92+
# https://stackoverflow.com/questions/29809105/how-do-i-delete-a-versioned-bucket-in-aws-s3-using-the-cli
93+
# TODO Later (Verify later)
94+
cat <<-__EOF__
95+
96+
# Delete all object versioning enabled
97+
aws s3api put-bucket-lifecycle-configuration \
98+
--lifecycle-configuration '{"Rules":[{
99+
"ID":"empty-bucket",
100+
"Status":"Enabled",
101+
"Prefix":"",
102+
"Expiration":{"Days":1},
103+
"NoncurrentVersionExpiration":{"NoncurrentDays":1}
104+
}]}' \
105+
--bucket ${aws_s3_bucket_name}
106+
107+
# Then you just have to wait 1 day and the bucket can be deleted with
108+
aws s3api delete-bucket --bucket ${aws_s3_bucket_name}
109+
110+
__EOF__
91111
}
92112

93113
aws_s3_rm_with_hint() {

0 commit comments

Comments
 (0)