Monorepo for multiple AWS Lambda functions with Terraform and a single API Gateway HTTP API.
- Node.js >= 18
- Terraform >= 1.5
- AWS CLI configured
- Language toolchains as needed:
- TypeScript/JavaScript: Node + npm
- Python: python3 + pip
- Go: Go 1.22+
- Java: JDK 17 + Maven
- Rust: Rust 1.74+ with
aarch64-unknown-linux-gnutarget
- functions/<function_name>/
- function.json (runtime, handler, env, routes)
- src/ (handler code)
- language build files (package.json, tsconfig.json, requirements.txt, go.mod, pom.xml)
- templates// (starter templates)
- infra/ (Terraform)
- scripts/ (build/package/deploy helpers)
- Copy a template:
- cp -R templates/ts functions/my-ts
- Edit function config:
- functions/my-ts/function.json
- Implement handler in functions/my-ts/src/
Package all functions:
- bash scripts/package.sh
Package a single function:
- bash scripts/package.sh my-ts
Generate infra/functions.auto.tfvars.json from all function.json files:
- node scripts/sync-terraform.js
Packages all functions, syncs Terraform inputs, then applies:
- bash scripts/deploy.sh
Pass terraform flags:
- bash scripts/deploy.sh -var 'enable_http_api=true'
Local (Node only):
- bash scripts/invoke-local.sh hello-ts
Remote via API Gateway:
- bash scripts/invoke-remote.sh hello-ts /hello-ts
Logs:
- bash scripts/tail-logs.sh hello-ts
Edit infra/terraform.tfvars for shared settings:
- aws_region
- project_name
- enable_http_api
- enable_function_url
Function-specific settings come from:
- functions//function.json
- API Gateway routes are defined per function via function.json routes.
- Go functions use provided.al2023 and a bootstrap binary.
- Rust functions use provided.al2023 and a bootstrap binary.
- Packaging produces dist/<function_name>.zip for Terraform.