我正在尝试使用 boto3 从 python3 创建一个 aws 存储桶。 create_bucket()
是我使用的方法。仍然出现错误botocore.errorfactory.BucketAlreadyExists
我的代码:
import boto3
ACCESS_KEY = 'theaccesskey'
SECRET_KEY = 'thesecretkey'
S3 = boto3.client('s3',
aws_access_key_id = ACCESS_KEY,
aws_secret_access_key = SECRET_KEY)
response = S3.create_bucket(Bucket='mynewbucket',
CreateBucketConfiguration={'LocationConstraint':'ap-south-1'})
错误:
botocore.errorfactory.BucketAlreadyExists: An error occurred (BucketAlreadyExists)
when calling the CreateBucket operation: The requested bucket name is not available.
The bucket namespace is shared by all users of the system.
Please select a different name and try again.
但是,存储桶不存在,创建存储桶仍然失败。
编辑
我从link中找到了原因,并且还将其张贴在答案中以帮助他人。