Reputation: 23
I'd like to use API Gateway as a proxy to S3. The bucket is keyed by a composite key made up of two parts like this: [userId]-[documentId].
UserId comes to API Gateway as a path parameter, documentId comes in as a request parameter, for example: [gateway-url]/user1?documentId=doc1
How can I combine the two so that the s3 lookup URL has the following format: https://[bucket-url]/user1-doc1
?
Thank you.
Upvotes: 2
Views: 2593
Reputation: 387
method.request.querystring.docid
and method.request.path.userid
as URL path params.A swagger snippet for this is as follows-
"paths": {
"/concat-params/{userid}": {
"get": {
"parameters": [
{
"name": "userid",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "docid",
"in": "query",
"required": false,
"type": "string"
}
],
"responses": {...},
"x-amazon-apigateway-integration": {
"responses": {...},
"requestParameters": {
"integration.request.path.userid":"method.request.path.userid",
"integration.request.path.docid":"method.request.querystring.docid"
},
"uri": "https:.../{userid}-{docid}",
...
}
}
}
Hope this helps, Ritisha.
Upvotes: 3