terraform-aws-lambda  by terraform-aws-modules

Terraform module for AWS Lambda resource management

created 5 years ago
997 stars

Top 38.0% on sourcepulse

GitHubView on GitHub
Project Summary

This Terraform module simplifies the creation and management of AWS Lambda functions and layers, offering extensive customization for build processes, deployments, and resource configurations. It's designed for Terraform users who need robust control over their serverless infrastructure, from dependency management to advanced deployment strategies like canary releases.

How It Works

The module leverages a Python script (package.py) to intelligently build deployment packages. It supports local builds or Dockerized builds (with SSH agent forwarding for private dependencies) for any Lambda runtime and architecture. The packaging process is optimized for speed and idempotency, generating identical zip archives for identical content to prevent unnecessary resource updates. It can also deploy pre-built packages from local paths, S3, or ECR container images.

Quick Start & Requirements

  • Install: Use the module in your Terraform configuration:
    module "lambda_function" {
      source = "terraform-aws-modules/lambda/aws"
      # ... other configurations
    }
    
  • Prerequisites: Terraform >= 1.0, AWS provider >= 5.79. Python 3.6+ is required for local builds. Docker is needed for Dockerized builds.
  • Setup: Basic setup involves defining the module in your .tf files. Complex builds or Docker configurations may require additional setup time.
  • Docs: serverless.tf framework

Highlighted Details

  • Supports building dependencies locally or within Docker, including private repositories via SSH agent forwarding.
  • Offers granular control over deployment packages, including multiple source paths, custom patterns, and build commands.
  • Facilitates advanced deployment strategies like rolling updates and canary releases using Lambda aliases and AWS CodeDeploy.
  • Integrates with AWS SAM CLI for local testing and cloud-based testing with SAM Accelerate.
  • Manages Lambda@Edge functions, VPC integration, EFS mounts, and event source mappings.

Maintenance & Community

Managed by Anton Babenko. Commercial support is available through Betajob.

Licensing & Compatibility

Apache 2.0 Licensed. Compatible with commercial use.

Limitations & Caveats

When using source_path with multiple concurrent module calls for the same source, zip archives can be corrupted; use hash_extra or external packaging. Terraform CI/CD workers may require a custom Docker image with Python pre-installed.

Health Check
Last commit

1 month ago

Responsiveness

1 day

Pull Requests (30d)
2
Issues (30d)
5
Star History
28 stars in the last 90 days

Explore Similar Projects

Starred by Jared Palmer Jared Palmer(Ex-VP of AI at Vercel; Founder of Turborepo; Author of Formik, TSDX), Travis Fischer Travis Fischer(Founder of Agentic), and
3 more.

docker-lambda by lambci

0%
6k
Deprecated: Docker images for replicating the AWS Lambda environment locally
created 9 years ago
updated 2 years ago
Feedback? Help us improve.