I am using Strong loop in AWS Lambda and i want to trigger it somehow. The only available option right now is APi Gateway. Is there a way to create one resource and pass all its requests to single lambda function?
I want to achieve something like this
/api/* --> Lambda Function
Does AWS support this?
This is supported by API gateway proxy resource. You can create a special path parameter {proxy+}
which represents any child resource of a parent API. The ANY
method can be used to catch all http methods on that resource.
In your case, you need to create an api resource /api
and under that, create a new proxy resource {proxy+}
. If you are creating it through the AWS console, you just have to check the check box for the option Configure as proxy resource while creating the resource. When you get to the integration setup, select Lambda Function Proxy as your integration type, choose the region and select the lambda function you want to invoke.
This is described in detail in the API gateway docs here.