Setting up an AWS Lambda

This page gives the basic steps for setting up a lambda in AWS. For additional information, and for actually completing the unicorn lab, see this page.

The steps:

  1. Go to the Lambda site from your console; click on the orange Create function button.
  2. Enter the function name and select Java 21 for the runtime.
  3. Open the arrow “Change default execution role”, select “use an existing role”, and set it to LabRole.
  4. Click the orange Create Function button.
  5. Upload the jar file into the code source box.
  6. Click Edit in the Runtime settings box and set the Handler to the handleRequest path. This will be something like “com.xyz.handler_class::handlerMethod”.
  7. Click on the Configuration tab and select Concurrency and recursion detection.
  8. Click Edit in the Concurrency box, select Reserve concurrency, and set the limit to 2.
  9. Click the orange Save button.

If relevant, create an API Gateway:

  1. Visit the API Gateway from the console AND click on the orange Create API button.
  2. Click Build in the HTTP API box.
  3. Name the API and click Add integration.
  4. Select Lambda, chose the Lambda function by entering bits of its name and then selecting the right one.
  5. Ensure Version is 2.0, click Next.
  6. In the Configure Routes box, set the resource path to the appropriate name and click Next.
  7. Keep the Stage name “$default” and click Next followed by Create.

If you have an API gateway, you can test by doing the following:

  1. Return to the home page for your lambda.
  2. Click on the Configuration tab, then click on Triggers.
  3. Copy the API endpoint to PostMan.
  4. Set Body to raw, enter the JSON values, and click Send.