Lambda function

In this step, you will create a new Lambda functions to answer unicorn requests to the list rides API.

In the Wild Rydes application, we have mapped each API method to an independent Lambda function.

You also have the option to group multiple API methods in a single Lambda function

Take a look at the code in the file .

  • The Lambda function expects the current unicorn name to be present in the authorizer context of the event.
  • Once the event is parsed, the function queries our DynamoDB rides table to extract all of the rows for the current unicorn.
  • The field is set by the custom authorizer you’ll create in the next step

Step 1: Go to AWS Lambda

Step 2: Choose Create Function

Step 3: Click the Author from scratch button at the top of the blueprint list

Step 4: Enter ListUnicornRides in the Name field

Step 5: Choose WildRydesLambda from the existing role

Step 6: Select Python 3.8 for the Runtime

Step 7: Click Create Function security

Step 8: Copy and Paste the code from into the code entry area security

Step 9: Click Save at the top of the page