Skip to main content
Data Storage Modules 0.35.0Last updated in version 0.33

DMS Module

View SourceRelease Notes

This module creates an Amazon Database Migration Service (DMS) that makes it possible to migrate data from one source database to another target database. You can use this module to migrate your data into the AWS Cloud or between combinations of cloud and on-premise setups. Currently, this module only support MySQL, MariaDB, and Aurora MySQL engines as source and target databases. Additional support for more database engines will be added in the future.

Sample Usage

main.tf

# ------------------------------------------------------------------------------------------------------
# DEPLOY GRUNTWORK'S DMS MODULE
# ------------------------------------------------------------------------------------------------------

module "dms" {

source = "git::git@github.com:gruntwork-io/terraform-aws-data-storage.git//modules/dms?ref=v0.35.0"

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

# The compute and memory capacity of the replication instance as specified by
# the replication instance class
instance_type = <string>

# The name used to namespace all resources created by these templates,
# including the DB instance (e.g. drupaldb). Must be unique for this region.
# May contain only lowercase alphanumeric characters, hyphens, underscores,
# periods, and spaces.
name = <string>

# Host name of the server.
source_endpoint_server_name = <string>

# A list of subnet ids where the Replication Instance should be deployed. In
# the standard Gruntwork VPC setup, these should be the private persistence
# subnet ids. This is ignored if create_subnet_group=false.
subnet_ids = <list(string)>

# Host name of the server.
target_endpoint_server_name = <string>

# The migration type. Can be one of `full-load` | `cdc` | `full-load-and-cdc`.
task_migration_type = <string>

# An escaped JSON string that contains the table mappings. For information on
# table mapping see
# http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TableMapping.html
task_table_mappings = <string>

# The id of the VPC in which this Replication Instance should be deployed.
vpc_id = <string>

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

# If false, the DMS instance will bind to `instance_subnet_group_id` variable.
create_subnet_group = true

# A map of custom tags to apply to the DMS Instance and the Security Group
# created for it. The key is the tag name and the value is the tag value.
custom_tags = {}

# The amount of storage (in gigabytes) to be initially allocated for the
# replication instance. Min: 5, Max: 6144, Default: 50
instance_allocated_storage = null

# Indicates that major version upgrades are allowed
instance_allow_major_version_upgrade = true

# Indicates whether the changes should be applied immediately or during the
# next maintenance window
instance_apply_immediately = null

# Indicates that minor engine upgrades will be applied automatically to the
# replication instance during the maintenance window
instance_auto_minor_version_upgrade = true

# The EC2 Availability Zone that the replication instance will be created in
instance_availability_zone = null

# The [engine
# version](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_ReleaseNotes.html)
# number of the replication instance
instance_engine_version = null

# The replication instance identifier. This parameter is stored as a lowercase
# string
instance_id = null

# The Amazon Resource Name (ARN) for the KMS key that will be used to encrypt
# the connection parameters
instance_kms_key_arn = null

# Specifies if the replication instance is a multi-az deployment. You cannot
# set the `availability_zone` parameter if the `multi_az` parameter is set to
# `true`
instance_multi_az = null

# The weekly time range during which system maintenance can occur, in
# Universal Coordinated Time (UTC)
instance_preferred_maintenance_window = null

# Specifies the accessibility options for the replication instance
instance_publicly_accessible = null

# An existing subnet group to associate with the replication instance
instance_subnet_group_id = null

# A map of additional tags to apply to the replication instance
instance_tags = {}

# A map of timeouts for replication instance create/update/delete operations
instance_timeouts = {}

# A list of VPC security group IDs to be used with the replication instance
instance_vpc_security_group_ids = null

# Name of the endpoint database
source_endpoint_database_name = null

# Type of engine for the endpoint.
source_endpoint_engine_name = "mysql"

# Additional attributes associated with the connection. For available
# attributes for a source Endpoint, see
# https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.html. For
# available attributes for a target Endpoint, see
# https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.html.
source_endpoint_extra_connection_attributes = null

# ARN for the KMS key that will be used to encrypt the connection parameters.
# If you do not specify a value for kms_key_arn, then AWS DMS will use your
# default encryption key. AWS KMS creates the default encryption key for your
# AWS account. Your AWS account has a different default encryption key for
# each AWS region
source_endpoint_kms_key_arn = null

# Password to be used to login to the endpoint database.
source_endpoint_password = null

# Port used by the endpoint database.
source_endpoint_port = null

# SSL mode to use for the connection. Valid values are none, require,
# verify-ca, verify-full
source_endpoint_ssl_mode = "none"

# User name to be used to login to the endpoint database.
source_endpoint_username = null

# The description of the aws_dms_replication_subnet_group that is created.
# Defaults to 'Subnet group for the var.name DB' if not specified.
subnet_group_description = null

# The name of the aws_dms_replication_subnet_group that is created, or an
# existing one to use if create_subnet_group is false. Defaults to var.name if
# not specified.
subnet_group_name = null

# Name of the endpoint database
target_endpoint_database_name = null

# Type of engine for the endpoint.
target_endpoint_engine_name = "mysql"

# Additional attributes associated with the connection. For available
# attributes for a source Endpoint, see
# https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.html. For
# available attributes for a target Endpoint, see
# https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.html.
target_endpoint_extra_connection_attributes = null

# ARN for the KMS key that will be used to encrypt the connection parameters.
# If you do not specify a value for kms_key_arn, then AWS DMS will use your
# default encryption key. AWS KMS creates the default encryption key for your
# AWS account. Your AWS account has a different default encryption key for
# each AWS region
target_endpoint_kms_key_arn = null

# Password to be used to login to the endpoint database.
target_endpoint_password = null

# Port used by the endpoint database.
target_endpoint_port = null

# SSL mode to use for the connection. Valid values are none, require,
# verify-ca, verify-full
target_endpoint_ssl_mode = "none"

# User name to be used to login to the endpoint database.
target_endpoint_username = null

# (Conflicts with task_cdc_start_time) Indicates when you want a change data
# capture (CDC) operation to start. The value can be in date, checkpoint, or
# LSN/SCN format depending on the source engine. For more information, see
# https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Task.CDC.html#CHAP_Task.CDC.StartPoint.Native.
task_cdc_start_position = null

# (Conflicts with task_cdc_start_position) The Unix timestamp integer for the
# start of the Change Data Capture (CDC) operation.
task_cdc_start_time = null

# An escaped JSON string that contains the task settings. For a complete list
# of task settings, see
# http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TaskSettings.html.
task_settings = null

# Whether to run or stop the replication task.
task_start_replication_task = false

}


Reference

Required

instance_typestringrequired

The compute and memory capacity of the replication instance as specified by the replication instance class

namestringrequired

The name used to namespace all resources created by these templates, including the DB instance (e.g. drupaldb). Must be unique for this region. May contain only lowercase alphanumeric characters, hyphens, underscores, periods, and spaces.

Host name of the server.

subnet_idslist(string)required

A list of subnet ids where the Replication Instance should be deployed. In the standard Gruntwork VPC setup, these should be the private persistence subnet ids. This is ignored if create_subnet_group=false.

Host name of the server.

task_migration_typestringrequired

The migration type. Can be one of full-load | cdc | full-load-and-cdc.

task_table_mappingsstringrequired

An escaped JSON string that contains the table mappings. For information on table mapping see http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TableMapping.html

vpc_idstringrequired

The id of the VPC in which this Replication Instance should be deployed.

Optional

If false, the DMS instance will bind to instance_subnet_group_id variable.

true
custom_tagsmap(string)optional

A map of custom tags to apply to the DMS Instance and the Security Group created for it. The key is the tag name and the value is the tag value.

{}

The amount of storage (in gigabytes) to be initially allocated for the replication instance. Min: 5, Max: 6144, Default: 50

null

Indicates that major version upgrades are allowed

true

Indicates whether the changes should be applied immediately or during the next maintenance window

null

Indicates that minor engine upgrades will be applied automatically to the replication instance during the maintenance window

true

The EC2 Availability Zone that the replication instance will be created in

null

The engine version number of the replication instance

null
instance_idstringoptional

The replication instance identifier. This parameter is stored as a lowercase string

null
instance_kms_key_arnstringoptional

The Amazon Resource Name (ARN) for the KMS key that will be used to encrypt the connection parameters

null
instance_multi_azbooloptional

Specifies if the replication instance is a multi-az deployment. You cannot set the availability_zone parameter if the multi_az parameter is set to true

null

The weekly time range during which system maintenance can occur, in Universal Coordinated Time (UTC)

null

Specifies the accessibility options for the replication instance

null

An existing subnet group to associate with the replication instance

null
instance_tagsmap(string)optional

A map of additional tags to apply to the replication instance

{}
instance_timeoutsmap(string)optional

A map of timeouts for replication instance create/update/delete operations

{}

A list of VPC security group IDs to be used with the replication instance

null

Name of the endpoint database

null

Type of engine for the endpoint.

"mysql"

Additional attributes associated with the connection. For available attributes for a source Endpoint, see https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.html. For available attributes for a target Endpoint, see https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.html.

null

ARN for the KMS key that will be used to encrypt the connection parameters. If you do not specify a value for kms_key_arn, then AWS DMS will use your default encryption key. AWS KMS creates the default encryption key for your AWS account. Your AWS account has a different default encryption key for each AWS region

null

Password to be used to login to the endpoint database.

null
source_endpoint_portnumberoptional

Port used by the endpoint database.

null

SSL mode to use for the connection. Valid values are none, require, verify-ca, verify-full

"none"

User name to be used to login to the endpoint database.

null

The description of the aws_dms_replication_subnet_group that is created. Defaults to 'Subnet group for the name DB' if not specified.

null
subnet_group_namestringoptional

The name of the aws_dms_replication_subnet_group that is created, or an existing one to use if create_subnet_group is false. Defaults to name if not specified.

null

Name of the endpoint database

null

Type of engine for the endpoint.

"mysql"

Additional attributes associated with the connection. For available attributes for a source Endpoint, see https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.html. For available attributes for a target Endpoint, see https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.html.

null

ARN for the KMS key that will be used to encrypt the connection parameters. If you do not specify a value for kms_key_arn, then AWS DMS will use your default encryption key. AWS KMS creates the default encryption key for your AWS account. Your AWS account has a different default encryption key for each AWS region

null

Password to be used to login to the endpoint database.

null
target_endpoint_portnumberoptional

Port used by the endpoint database.

null

SSL mode to use for the connection. Valid values are none, require, verify-ca, verify-full

"none"

User name to be used to login to the endpoint database.

null

(Conflicts with task_cdc_start_time) Indicates when you want a change data capture (CDC) operation to start. The value can be in date, checkpoint, or LSN/SCN format depending on the source engine. For more information, see https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Task.CDC.html#CHAP_Task.CDC.StartPoint.Native.

null
task_cdc_start_timestringoptional

(Conflicts with task_cdc_start_position) The Unix timestamp integer for the start of the Change Data Capture (CDC) operation.

null
task_settingsstringoptional

An escaped JSON string that contains the task settings. For a complete list of task settings, see http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TaskSettings.html.

null

Whether to run or stop the replication task.

false