这是我的代码,
session = Session(access_key_id='',secret_access_key='',region_name='ap-southeast-1')
conn = session.client('support')
checks = conn.describe_trusted_advisor_checks(language='en')
这给了我以下错误,
Could not connect to the endpoint URL: "https://support.ap-southeast-1.amazonaws.com/"
如此处所述,AWS支持只有一个终点,
http://docs.aws.amazon.com/general/latest/gr/rande.html#awssupport_region
所以我将region_name更改为us-east-1
现在代码看起来,
session = Session(access_key_id='',secret_access_key='',region_name='us-east-1')
conn = session.client('support')
checks = conn.describe_trusted_advisor_checks(language='en')
但现在我面对这个错误,
botocore.exceptions.ClientError: An error occurred (AccessDeniedException) when calling the DescribeTrustedAdvisorChecks operation: User: abc is not authorized to perform: support:
我只在新加坡地区有实例,为什么会出现此错误,我可以使用support
,即使我只有Singapore region
中的实例且端点为us-east-1
答案 0 :(得分:2)
AWS Support不是特定于地区的。您需要附加到用户的IAM政策AWSSupportAccess
。
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["support:*"],
"Resource": "*"
}
]
}
请参阅我对类似问题的回答:AccessDeniedException on aws when i'm trying to raise a support ticket
答案 1 :(得分:1)
使用上面的代码时,我必须做3件事才能完成这项工作:
us-east-1
和AWSSupportAccess
角色分配给我的用户/群组答案 2 :(得分:0)
我认为您所遇到的错误与您的实例位于ap-southeast-1
区域的事实无关。该错误表示您在连接到支持服务时使用的凭据尚未被授予在支持服务中执行操作所需的权限。
检查与您的凭据相关联的政策,并确保其中包含授予support
服务访问权限的操作。