Skip to content
VirtualLP Virtual Learning Platform
Amazon Web Services AWS-06 beginner

Build, test and debug your first Lambda function

Write a Node.js Lambda function that really runs: test it with JSON events, configure environment variables, hit a real timeout, fix it and read the logs in CloudWatch.

What you'll do

  • Create a Lambda function with an execution role
  • Edit, deploy and test code with test events
  • Use environment variables for configuration
  • Understand timeouts and the execution lifecycle
  • Read START/END/REPORT lines in CloudWatch Logs

Lab tasks

  1. 1 Create the function hello-lambda
  2. 2 Return a personalised greeting and deploy
  3. 3 Test with the event {"name": "Asha"}
  4. 4 Move the greeting word into an environment variable
  5. 5 Make the function exceed its 3-second timeout
  6. 6 Raise the timeout to 10 seconds and succeed
  7. 7 Inspect the function’s CloudWatch Logs