0

我正在使用 Babun 终端为 AWS 运行 python 命令,但遇到一些错误->

cors_configuration={
... 'CORSRules':[{'AllowedHeaders':['Authorization'],'AllowedMethods':['GET','PUT'],'AllowedOrigins':['*'],'ExposeHeaders':['GET','PUT'],'MaxAgeSeconds':3000}]}
s3.put_bucket_cors(Bucket='mynamebuckets',CORSConfiguration=cors_configuration)
/usr/lib/python2.7/site-packages/urllib3/util/ssl_.py:387: SNIMissingWarning: An HTTPS request has been made, but the SNI (Server Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  SNIMissingWarning,
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/botocore/client.py", line 316, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/lib/python2.7/site-packages/botocore/client.py", line 635, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the PutBucketCors operation: Access Denied

请让我知道解决此问题的解决方案。

4

1 回答 1

0

没有提供凭据,可以采取以下操作来允许此脚本运行。

  • 如果此脚本在 EC2 上运行,您可以使用将IAM 角色附加到您的实例
  • 或者,如果您不在 AWS 中,请创建具有权限的 IAM 用户,然后执行以下操作之一
于 2020-06-27T19:19:59.007 回答