Lambda Function Basic
๐ฆ Overviewโ
This Terraform module provisions a basic AWS Lambda function with a configurable runtime, handler, and pre-packaged source code archive. It provides a fast, repeatable way to deploy serverless functions in any AWS environment.
โ Key Featuresโ
- Deploys a Lambda function with defined runtime and handler
- Accepts zipped source archive via
source_path - Supports tagging for environment and visibility
- Lightweight and ideal for serverless automations and microservices
๐ผ Use Casesโ
- Webhook handlers or lightweight APIs
- Scheduled tasks via EventBridge
- Automation scripts or real-time log processors
- Prototyping serverless workloads
๐ฅ Input Variablesโ
| Name | Type | Description |
|---|---|---|
| region | string | AWS region where the Lambda function is deployed |
| function_name | string | Name of the Lambda function |
| runtime | string | Lambda runtime (e.g., nodejs18.x, python3.11) |
| handler | string | Entry point for your code (e.g., index.handler) |
| source_path | string | Path to ZIP archive containing Lambda code |
| environment | string | Tag for the environment (e.g., dev, prod) |
๐ค Outputsโ
| Name | Description |
|---|---|
| function_name | The name of the created Lambda function |
| function_arn | The ARN of the created Lambda function |
๐ Deployment Readinessโ
- โ Compatible with Terraform 1.0+
- โ Uses AWS Provider 5.x+
- ๐ Requires
lambda:CreateFunctionpermissions - ๐ฆ Source must be a valid ZIP archive
๐ ๏ธ Example Usageโ
module "lambda_function_basic_deployment" {
source = "git::ssh://git@github.com/archiphire/aws-level-1-modules.git//compute/lambda-function-basic?ref=v1.0.0"
region = "us-east-1"
function_name = "my-basic-lambda"
runtime = "nodejs18.x"
handler = "index.handler"
source_path = "./lambda-code.zip"
environment = "dev"
}
terraform init
terraform plan
terraform apply
or
tofu init
tofu plan
tofu apply
๐งน Cleanupโ
Terraform Destroy (Isolated Use):
terraform destroy
or
tofu destroy
Manual Deletion (Recommended for Production):
aws lambda delete-function --function-name my-basic-lambda
๐ก๏ธ Notesโ
This is a Level 1 compute module designed for rapid serverless function provisioning.
To integrate with other services like API Gateway, EventBridge, or S3, use this module with other Archiphire components.
๐ Deployment Package Noticeโ
This module is part of the Level 1 AWS License Tier.
To access the full deployment package and source code, subscribe to Archiphire.