AWS API网关错误:API网关没有将提供的角色设为S3代理的权限
问题描述:
也有类似的问题,但他们有我尝试过的答案。 我不知道我会做错什么,但任何帮助将不胜感激。AWS API网关错误:API网关没有将提供的角色设为S3代理的权限
从一个方法,执行测试的误差; PUT请求:
Execution log for request test-request
Mon Oct 16 10:13:47 UTC 2017 : Starting execution for request: test-invoke-request
Mon Oct 16 10:13:47 UTC 2017 : HTTP Method: PUT, Resource Path: /pop-data-xmlz/test.xml
Mon Oct 16 10:13:47 UTC 2017 : Method request path: {item=test.xml, folder=pop-data-xmlz}
Mon Oct 16 10:13:47 UTC 2017 : Method request query string: {}
Mon Oct 16 10:13:47 UTC 2017 : Method request headers: {Content-Type=application/xml}
Mon Oct 16 10:13:47 UTC 2017 : Method request body before transformations: <test>
test string
</test>
Mon Oct 16 10:13:47 UTC 2017 : Request validation succeeded for content type application/json
Mon Oct 16 10:13:47 UTC 2017 : Execution failed due to configuration error: API Gateway does not have permission to assume the provided role
Mon Oct 16 10:13:47 UTC 2017 : Method completed with status: 500
我下面的API网关S3教程(http://docs.aws.amazon.com/apigateway/latest/developerguide/integrating-api-with-aws-services-s3.html),并试图执行一个PUT请求。
API网关位于us-east-1中,S3存储桶位于us-east-2中。
创建的角色:APIGatewayProxyCustom
答
要解决这个问题转到您的IAM角色并选择“信任关系”选项卡。从这里编辑政策和主要服务添加到“apigateway.amazonaws.com”中,如下所示。除了现有的lambda权限之外,这将授予API网关承担角色以运行您的功能的能力。
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": ["apigateway.amazonaws.com","lambda.amazonaws.com"]
},
"Action": "sts:AssumeRole"
}
]
}
非常感谢!阻止我疯狂。官方的文档再次没有提到这一点,他们非常糟糕! –
不用客气@CliveSargeant。很高兴知道它有助于:) –
感谢这! –