Skip to main content
AWS Lambda 0.21.18Last updated in version 0.21.15

Scheduled Lambda Job Module

View SourceRelease Notes

This module makes it easy to run an AWS Lambda function (such as one created with the lambda module) on a scheduled basis. This is useful for periodic background jobs, such as taking a daily snapshot of your servers.

Background info

For more information on AWS Lambda, how it works, and how to configure your functions, check out the lambda module documentation.

Sample Usage

main.tf

# ------------------------------------------------------------------------------------------------------
# DEPLOY GRUNTWORK'S SCHEDULED-LAMBDA-JOB MODULE
# ------------------------------------------------------------------------------------------------------

module "scheduled_lambda_job" {

source = "git::git@github.com:gruntwork-io/terraform-aws-lambda.git//modules/scheduled-lambda-job?ref=v0.21.18"

# ----------------------------------------------------------------------------------------------------
# REQUIRED VARIABLES
# ----------------------------------------------------------------------------------------------------

# The ARN of the lambda function.
lambda_function_arn = <string>

# The name of the lambda function.
lambda_function_name = <string>

# An expression that defines the schedule for this lambda job. For example,
# cron(0 20 * * ? *) or rate(5 minutes).
schedule_expression = <string>

# ----------------------------------------------------------------------------------------------------
# OPTIONAL VARIABLES
# ----------------------------------------------------------------------------------------------------

# Set to false to have this module skip creating resources. This weird
# parameter exists solely because Terraform does not support conditional
# modules. Therefore, this is a hack to allow you to conditionally decide if
# this module should create anything or not.
create_resources = true

# JSON text that will be passed to the lambda function on each invoke.
lambda_function_input = null

# The namespace to use for all resources created by this module. If not set,
# var.lambda_function_name, with '-scheduled' as a suffix, is used.
namespace = null

# A map of tags to apply to the event rule.
tags = {}

}


Reference

Required

lambda_function_arnstringrequired

The ARN of the lambda function.

lambda_function_namestringrequired

The name of the lambda function.

schedule_expressionstringrequired

An expression that defines the schedule for this lambda job. For example, cron(0 20 * ? ) or rate(5 minutes).

Optional

create_resourcesbooloptional

Set to false to have this module skip creating resources. This weird parameter exists solely because Terraform does not support conditional modules. Therefore, this is a hack to allow you to conditionally decide if this module should create anything or not.

true
lambda_function_inputstringoptional

JSON text that will be passed to the lambda function on each invoke.

null
namespacestringoptional

The namespace to use for all resources created by this module. If not set, lambda_function_name, with '-scheduled' as a suffix, is used.

null
tagsmap(string)optional

A map of tags to apply to the event rule.

{}