我正在使用适用于Python的AWS开发工具包(boto3)自动执行一些AWS服务的设置,并且遇到了创建S3存储桶的非常简单的问题。
我仔细检查了以下内容:
~/.aws/credentials
,我设置了访问密钥ID和秘密访问密钥。此访问密钥ID /秘密访问密钥用于属于组且附加了以下策略的帐户:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "*",
"Resource": "*"
}
]
}
但是,当我尝试运行此非常简单的操作时,它失败了:
>>> 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.
我觉得我很想念某些东西,但是我一生都无法想像这可能是什么,或者我做错了什么。
存储桶名称对于区域而言是全局的,而不是特定于您的帐户的。因此,您需要选择一个根本不存在的名称。我建议使用前缀
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句