Handling GET Requests with Path Parameters in AWS Lambda

Learn how to handle GET requests with path parameters in AWS Lambda using TypeScript.

Handling path parameters in Lambda functions

A number of our Lambda functions have a path parameter within them. So, to GET details of a particular user, we will need to use the URL /users/{userId}, where we substitute the {userId} variable with the actual value. In other words, to GET the details of a user named test_user_1, our path would need to be /users/test_user_1. This is a standard REST pattern, where the URL itself contains a parameter.

Let’s now take a look at how the definition of the user’s GET Lambda function in our template.yaml file supports this syntax as follows:

Get hands-on with 1200+ tech skills courses.