我无法通过Api Gataway访问S3。我订阅了以下模板:
/s3:
get:
produces:
- application/json
parameters:
- name: "key"
in: "query"
required: false
type: "string"
responses:
"200":
description: 200 response
x-amazon-apigateway-integration:
credentials:
Fn::GetAtt:
- ApiRole
- Arn
requestParameters:
- integration.request.path.key: "method.request.querystring.key"
uri: "arn:aws:apigateway:eu-west-1:s3:path/{key}"
consumes:
- application/json
produces:
- application/json
responses:
default:
statusCode: '200'
passthroughBehavior: when_no_match
httpMethod: GET
type: aws
但是当我检查工作时:
我得到一个错误:
Execution failed due to configuration error: Illegal character in path at index 35: https://s3-eu-west-1.amazonaws.com/{key}
Thu Dec 13 22:46:03 UTC 2018 : Method completed with status: 500
可能我的查询字符串未在集成请求中覆盖。但是我不知道该怎么做。
答案 0 :(得分:0)
我不确定这是否行得通,但您可能想将{s3} pathParam更改为{proxy +},以将pathParam转换为/'*'通配符。 参见https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-method-settings-method-request.html 祝你好运!