API Gateway Integration

Prerequisites

  • AWS account with appropriate permissions
  • Terraform >= 1.0

Step 1: Create the Function

module "api_handler" {
  source  = "registry.patterneddesigns.ca/patterneddesigns/lambda-function/aws"
  version = "3.1.0"

  function_name = "api-handler"
  handler       = "index.handler"
  runtime       = "nodejs20.x"
  source_path   = "./src/api"
  timeout       = 30
}

Step 2: Add API Gateway Trigger

Configure API Gateway to invoke the Lambda function.

Step 3: Deploy and Test

Run terraform apply and test your API endpoint.