Code Monkey home page Code Monkey logo

tf_aws_lambda_scheduled's Introduction

Scheduled AWS Lambda function

=============================

This module can be used to deploy an AWS Lambda function which is scheduled to run on a recurring basis.

Module Input Variables

  • lambda_name - Unique name for Lambda function
  • memory_size (optional) - Amount of memory in MB your Lambda Function can use at runtime. Defaults to 128.
  • runtime - A valid Lambda runtime environment
  • lambda_zipfile - path to zip archive containing Lambda function
  • source_code_hash - the base64 encoded sha256 hash of the archive file - see TF archive file provider
  • handler - the entrypoint into your Lambda function, in the form of filename.function_name
  • schedule_expression - a valid rate or cron expression
  • iam_policy_document - a valid IAM policy document used for the Lambda's execution role
  • timeout - (optional) the amount of time your Lambda Function has to run in seconds. Defaults to 3. See Limits
  • subnet_ids (optional) - If set, the lambda will be deployed inside a VPC on the subnet(s) specified. Expects a comma separated list of valid AWS subnet ids.
  • security_group_ids (optional) - If set, the lambda will be deployed inside a VPC and use the security groups specified. Expects a comma separated list of valid VPC security group ids .
  • enabled - boolean expression. If false, the lambda function and the cloudwatch schedule are not set. Defaults to true.

Usage

data "aws_iam_policy_document" "create_snaps" {
  statement {
    sid = "1"

    actions = [
      "ec2:DescribeVolumes",
      "ec2:CreateSnapshot",
      "ec2:CreateTags",
    ]

    resources = [
      "*",
    ]
  }
}

data "archive_file" "myfunction" {
  type        = "zip"
  source_file = "/valid/path/to/myfunction.py"
  output_path = "/valid/path/to/myfunction.zip"
}

module "lambda_scheduled" {
  source              = "github.com/terraform-community-modules/tf_aws_lambda_scheduled"
  lambda_name         = "my_scheduled_lambda"
  runtime             = "python2.7"
  lambda_zipfile      = "/valid/path/to/myfunction.zip"
  source_code_hash    = "${data.archive_file.myfunction.output_base64sha256}"
  handler             = "myfunction.handler"
  schedule_expression = "rate(1 day)"
  iam_policy_document = "${data.aws_iam_policy_document.create_snaps.json}"
}

Outputs

  • lambda_arn - ARN for the created Lambda function

Author

Created and maintained by Shayne Clausson

tf_aws_lambda_scheduled's People

Contributors

lgallard avatar wp-davisona avatar michaelwittig avatar sclausson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.