Skip to main content

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โ€‹

NameTypeDescription
regionstringAWS region where the Lambda function is deployed
function_namestringName of the Lambda function
runtimestringLambda runtime (e.g., nodejs18.x, python3.11)
handlerstringEntry point for your code (e.g., index.handler)
source_pathstringPath to ZIP archive containing Lambda code
environmentstringTag for the environment (e.g., dev, prod)

๐Ÿ“ค Outputsโ€‹

NameDescription
function_nameThe name of the created Lambda function
function_arnThe ARN of the created Lambda function

๐Ÿš€ Deployment Readinessโ€‹

  • โœ… Compatible with Terraform 1.0+
  • โœ… Uses AWS Provider 5.x+
  • ๐Ÿ” Requires lambda:CreateFunction permissions
  • ๐Ÿ“ฆ 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.