~/codewithstu

// open_source

AWS Scheduled Lambda

OpenTofu module for provisioning scheduled AWS Lambda functions triggered by EventBridge cron or rate expressions with VPC and Secrets Manager support

View on GitHub

Overview

This module creates an AWS Lambda function triggered by EventBridge on a schedule. It wraps the opentofu-aws-lambda module and adds EventBridge scheduling using cron or rate expressions.

Key Features

  • Lambda function with EventBridge schedule trigger
  • Supports cron and rate schedule expressions
  • Container image deployment via ECR image URI
  • VPC configuration with subnet and security group support
  • Secrets Manager integration for secure configuration
  • Additional IAM policy statements for custom permissions
  • Configurable memory, timeout, architecture, and log retention

Usage

module "scheduled_lambda" {
  source = "git::https://github.com/Im5tu/opentofu-aws-scheduled-lambda.git?ref=main"
 
  function_name       = "my-scheduled-task"
  image_uri           = "123456789012.dkr.ecr.eu-west-1.amazonaws.com/my-app:latest"
  schedule_expression = "rate(5 minutes)"
}