Skip to main content
Type: rvn-lambda / Latest version: 2.4.0

Dependencies and consumers

Every dependency input can be specified manually to reference existing external infrastructure rather than a Ravion module. Set the dependency input to null and set its mapped inputs directly; see Use existing infrastructure instead of a module reference.

Readme

AWS Lambda function with zip or container image deployments, alias-based releases, IAM, logs, and optional function URLs.

Overview

The Lambda Function module creates an AWS Lambda function, execution role, CloudWatch log group, optional artifact bucket, and a live alias that Ravion updates during deployments. Terraform provisions the long-lived function infrastructure with either a bootstrap zip package or a bootstrap container image. Deployments publish a new function version and move the live alias. Terraform source: ravionhq/modules/compute/lambda

Deployment and rollback

Rollbacks move the live alias to an existing published version, restoring its code and function configuration without rebuilding. Function URLs and event source mappings invoke that alias. Terraform does not reset the live alias version after deployment or rollback; other aliases remain Terraform-managed. Only invocations through the deployment alias follow rollback; unqualified invocations use $LATEST. AWS_IAM function URL callers need lambda:InvokeFunctionUrl and lambda:InvokeFunction on the live alias ARN. Public (NONE) URLs receive alias-qualified permissions restricted to URL invocations. Image rollback targets must have a recorded digest that still exists in ECR. Keep rollback images outside destructive ECR lifecycle rules.

Use cases

Build and deployment

Lambda type and package type are immutable after creation. Lambda@Edge functions must be created in us-east-1, and AWS Lambda does not support changing an existing function between zip packages and container images. For zip package functions, builds use a Dockerfile to produce Lambda package contents from the selected Git repository. The build uploads a zip file to the module-managed code bucket. Deployments take an S3 object key, update the Lambda function code, publish a new version, and move the live alias to that version. If Build source is Pull from S3 for zip packages, Ravion skips the build step and you provide an existing S3 object key at deploy time. For container image functions, Nixpacks and Dockerfile builds produce a Lambda-compatible container image, push it to a module-managed ECR repository, and deployments promote a tag or digest from that repository. Pull from image registry skips the build step and promotes a tag or digest from the ECR repository configured on the module. Image start command, entry point, and working directory overrides are optional; leave them empty to use the image defaults. Terraform creates image package functions by pushing a small Lambda-compatible bootstrap image into a module-managed ECR repository during the same apply. For Pull from image registry, that bootstrap image lets the function be created before the first deployment promotes the configured ECR image tag or digest.

Function configuration

Runtime, handler, memory, timeout, architecture, environment variables, layers, tracing, image config, and ephemeral storage are managed by the stack. Handler, runtime, layers, code signing, SnapStart, Lambda@Edge constraints, and the code bucket apply only to zip package functions. Change these settings through a stack change so Terraform remains the source of truth for function configuration. The deploy step focuses on code promotion.

Networking and integrations

Connect to a VPC when the function needs private subnet access to databases, caches, or internal services. Invoke permissions let AWS services or accounts call the function. Event source mappings connect queues and streams directly to the function. File systems mount EFS access points under /mnt paths.

Configuration

Design decisions

  • Lambda type is immutable. Create a new Lambda module/function to migrate between Regional Lambda and CloudFront Lambda@Edge, especially when the existing function is outside us-east-1.
  • Package type is immutable. Create a new Lambda module/function to migrate between zip packages and container images.
  • Zip package functions use the Lambda build pipeline to upload zip packages to S3 and the Lambda deploy manager to promote those packages.
  • Container image functions use the image build pipeline to push Dockerfile or Nixpacks builds to ECR. Pull from image registry promotes tags or digests from an existing ECR repository.
  • Terraform creates a bootstrap zip package for zip functions and creates image package functions with a bootstrap image in the module-managed ECR repository.
  • Runtime configuration stays in Terraform to avoid deploy-time configuration drift.
  • The zip code bucket is versioned, but the build output currently passes the S3 key as the primary deploy input.

Error-rate monitoring

Invocation error-rate alarms are enabled by default in Ravion. The default is at least 1% failed invocations over one 5-minute period. Idle functions do not alert. Configure notification action ARNs or an external EventBridge relay to receive alerts. For Lambda@Edge, select every additional execution region and provide regional action ARN overrides. The origin-region alarm is always included; it alone does not cover worldwide traffic. Add regions as traffic expands. These alarms monitor invocation failures, not HTTP status codes returned by application code or throttled requests.

Learn more

Inputs reference

All inputs for rvn-lambda version 2.4.0. Use the name shown for each field as the input key in module config.