Delete AWS S3 buckets using boto3 - AttributeError

Viewed 7293

I'm attempting to delete an S3 bucket using boto3 library

import boto3

s3 = boto3.client('s3')
bucket = s3.Bucket('my-bucket')
response = bucket.delete()

I get the following error:

"errorType": "AttributeError",
"errorMessage": "'S3' object has no attribute 'Bucket'"

I cannot see what's wrong... Thanks

3 Answers
Related