为什么 AWS 告诉我 BucketAlreadyExists 却没有?

Why is AWS telling me BucketAlreadyExists when it doesn't?

我正在使用适用于 Python (boto3) 和 运行 的 AWS SDK 自动设置某些 AWS 服务,解决一个非常简单的创建 S3 存储桶的问题。

我仔细检查了以下内容:

然而,当我尝试 运行 这个非常简单的操作时,它失败了:

>>> import boto3
>>> client = boto3.client('s3')
>>> response = client.create_bucket('staging')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/yiqing/Repos/ansible-home/roles/osx/files/virtualenvs/obaku/lib/python2.7/site-packages/botocore/client.py", line 157, in _api_call
    "%s() only accepts keyword arguments." % py_operation_name)
TypeError: create_bucket() only accepts keyword arguments.
>>> response = client.create_bucket(Bucket='staging')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/yiqing/Repos/ansible-home/roles/osx/files/virtualenvs/obaku/lib/python2.7/site-packages/botocore/client.py", line 159, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/yiqing/Repos/ansible-home/roles/osx/files/virtualenvs/obaku/lib/python2.7/site-packages/botocore/client.py", line 494, in _make_api_call
    raise ClientError(parsed_response, operation_name)
botocore.exceptions.ClientError: 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.

我觉得我错过了一些非常愚蠢的东西,但我一辈子都想不出它可能是什么或者我做错了什么。

存储桶名称是全球性的,并不特定于您的帐户。 所以你需要选择一个根本不存在的名字。我建议使用前缀