Skip to content

Add Terraform setup for Lambda using Mangum and API Gateway #69

Description

@Subhransu-De

What to build

Add a Terraform infrastructure setup under /infra that deploys this FastAPI template to AWS Lambda using Mangum behind API Gateway HTTP API. This setup represents the common ASGI-adapter approach for running FastAPI on Lambda.

This issue may include the minimal app-side Lambda handler needed for Mangum, while keeping the normal local/Docker runtime intact.

Acceptance criteria

  • Terraform provisions Lambda, IAM role, API Gateway HTTP API, Lambda integration, permissions, and CloudWatch logging.
  • The FastAPI app can be invoked through API Gateway using a catch-all route.
  • Mangum integration is added without breaking the existing Docker and local development entrypoints.
  • Lambda timeout, memory, architecture, environment variables, and secret references are configurable.
  • Documentation explains how this differs from the Lambda Web Adapter setup.
  • Documentation calls out Lambda-specific caveats around FastAPI lifespan events, app startup migrations, cold starts, and DB pooling.
  • Outputs include API endpoint URL, Lambda function name, API Gateway ID, and log group name.
  • A verification command is documented for checking the deployed health endpoint.

Blocked by

None - can start immediately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestinfraInfrastructure and deployment work

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions