Share Snapshot Lambda Module
This module creates an AWS Lambda function that can share snapshots of an Amazon Relational Database (RDS) database with another AWS account. Typically, the snapshots are created by the lambda-create-snapshot module, which can be configured to automatically trigger this lambda function after each run.
Background info
For more info on how to backup RDS snapshots to a separate AWS account, check out the lambda-create-snapshot module documentation.
Sample Usage
- Terraform
- Terragrunt
# ------------------------------------------------------------------------------------------------------
# DEPLOY GRUNTWORK'S LAMBDA-SHARE-SNAPSHOT MODULE
# ------------------------------------------------------------------------------------------------------
module "lambda_share_snapshot" {
source = "git::git@github.com:gruntwork-io/terraform-aws-data-storage.git//modules/lambda-share-snapshot?ref=v0.40.0"
# ----------------------------------------------------------------------------------------------------
# REQUIRED VARIABLES
# ----------------------------------------------------------------------------------------------------
# The ARN of the RDS database
rds_db_arn = <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
# The maximum number of retries the lambda function will make while waiting
# for the snapshot to be available
max_retries = 60
# The name for the lambda function and other resources created by these
# Terraform configurations
name = "share-rds-snapshot"
# The amount of time, in seconds, between retries.
sleep_between_retries_sec = 60
}
# ------------------------------------------------------------------------------------------------------
# DEPLOY GRUNTWORK'S LAMBDA-SHARE-SNAPSHOT MODULE
# ------------------------------------------------------------------------------------------------------
terraform {
source = "git::git@github.com:gruntwork-io/terraform-aws-data-storage.git//modules/lambda-share-snapshot?ref=v0.40.0"
}
inputs = {
# ----------------------------------------------------------------------------------------------------
# REQUIRED VARIABLES
# ----------------------------------------------------------------------------------------------------
# The ARN of the RDS database
rds_db_arn = <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
# The maximum number of retries the lambda function will make while waiting
# for the snapshot to be available
max_retries = 60
# The name for the lambda function and other resources created by these
# Terraform configurations
name = "share-rds-snapshot"
# The amount of time, in seconds, between retries.
sleep_between_retries_sec = 60
}
Reference
- Inputs
- Outputs
Required
rds_db_arn
stringThe ARN of the RDS database
Optional
create_resources
boolSet 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
max_retries
numberThe maximum number of retries the lambda function will make while waiting for the snapshot to be available
60
name
stringThe name for the lambda function and other resources created by these Terraform configurations
"share-rds-snapshot"
The amount of time, in seconds, between retries.
60