How to get the path param value in java AWS Lambda

2019-09-14 21:09发布

问题:

URL: /test/{userName}

In AWS Lambda function, How can I get the {username} path parameter value. I am calling lambda function through AWS API gaetway.

回答1:

If you are using AWS integration type:

Use a mapping template to send $input.params('username') property in the request body to your Lambda function.

If you are using AWS_PROXY integration type:

You can access the path parameters via the "pathParameters" property of the incoming event.