Python脚本快速删除S3存储桶
#aws #python #s3

我不得不使用AWS控制台删除并删除S3存储桶感到沮丧,所以我创建了一个Python脚本来为我做!

BUCKETS = [
    "bucket-one",
    "bucket-two",
]

import boto3

s3 = boto3.resource("s3")
for bucket_name in BUCKETS:
    bucket = s3.Bucket(bucket_name)
    bucket.object_versions.delete()

    bucket.delete()