AWS DMS Replication Subnet Group

This page shows how to write Terraform and CloudFormation for AWS DMS Replication Subnet Group and write them securely.

aws_dms_replication_subnet_group (Terraform)

The Replication Subnet Group in AWS DMS can be configured in Terraform with the resource name aws_dms_replication_subnet_group. The following sections describe 2 examples of how to use the resource and its parameters.

Example Usage from GitHub

subnet_groups.tf#L2
resource "aws_dms_replication_subnet_group" "dms-subnet-group" {
  replication_subnet_group_description = "subnet group for DMS"
  replication_subnet_group_id  = "dms-subnet-group"
  subnet_ids = [ "subnet-08028120cbe0274fc",
  "subnet-013d2eda039a14bf5", "subnet-01ffafbd540cf34e9"
   ]
main.tf#L7
resource "aws_dms_replication_subnet_group" "this" {
  replication_subnet_group_description = var.replication_subnet_group_description
  replication_subnet_group_id          = var.replication_subnet_group_id
  subnet_ids                           = var.subnet_ids
  tags                                 = var.tags
}

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Provides a DMS (Data Migration Service) replication subnet group resource. DMS replication subnet groups can be created, updated, deleted, and imported.

AWS::DMS::ReplicationSubnetGroup (CloudFormation)

The ReplicationSubnetGroup in DMS can be configured in CloudFormation with the resource name AWS::DMS::ReplicationSubnetGroup. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

customer360-dms.yml#L83
    Type: AWS::DMS::ReplicationSubnetGroup
    Properties:
      ReplicationSubnetGroupDescription: Subnets available for DMS
      SubnetIds:
        - Fn::ImportValue: !Sub '${EnvironmentName}:PublicSubnet1'
        - Fn::ImportValue: !Sub '${EnvironmentName}:PublicSubnet2'
DMSWithExternalDB.yml#L68
    Type: 'AWS::DMS::ReplicationSubnetGroup'
    Properties:
      ReplicationSubnetGroupDescription: Subnets available for DMS
      SubnetIds:
        - !Ref DBSubnet1
        - !Ref DBSubnet2
IngestionLayer.yml#L123
#    Type: AWS::DMS::ReplicationSubnetGroup
#    Properties:
#      ReplicationSubnetGroupIdentifier: replication-subnet-group
#      ReplicationSubnetGroupDescription: Subnet group for DMS
#      SubnetIds:
#        - !Ref RDSPrivateSubnet1
01.DMS_Replication_Instance_Creation.yml#L110
    Type: 'AWS::DMS::ReplicationSubnetGroup'
    Properties:
      ReplicationSubnetGroupDescription: Subnets available for DMS
      SubnetIds:
        - !Ref DBSubnet1
        - !Ref DBSubnet2
sc-test-resources-cfn.yml#L108
    Type: AWS::DMS::ReplicationSubnetGroup
    Properties:
      ReplicationSubnetGroupIdentifier: "dmstestreplicationgroup"
      ReplicationSubnetGroupDescription: "Test DMS Replication Group"
      SubnetIds:
        - !Ref SubnetA
dms.json#L95
      "Type" : "AWS::DMS::ReplicationSubnetGroup",
      "Properties" : {
        "ReplicationSubnetGroupIdentifier" : "DMS-SubnetGrp",
        "ReplicationSubnetGroupDescription" : "Subnets available for DMS",
        "SubnetIds" : [ { "Ref" : "ExistingSubnet1" }, { "Ref" : "ExistingSubnet2" } ],
      }
dms_subnetgroup.json#L4
      "Type" : "AWS::DMS::ReplicationSubnetGroup",
      "Properties" : {
            "ReplicationSubnetGroupIdentifier": "{{dmssubnet}}",
            "ReplicationSubnetGroupDescription": "{{settings["description"]}}",
            "SubnetIds" : [
                  {% for subnet in settings["subnets"] %}
DMSReplicationSubnetGroupSpecification.json#L22
    "AWS::DMS::ReplicationSubnetGroup": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationsubnetgroup.html",
      "Properties": {
        "ReplicationSubnetGroupDescription": {
          "Required": true,
          "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationsubnetgroup.html#cfn-dms-replicationsubnetgroup-replicationsubnetgroupdescription",
DMSReplicationSubnetGroupSpecification.json#L22
    "AWS::DMS::ReplicationSubnetGroup": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationsubnetgroup.html",
      "Properties": {
        "ReplicationSubnetGroupDescription": {
          "Required": true,
          "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationsubnetgroup.html#cfn-dms-replicationsubnetgroup-replicationsubnetgroupdescription",
DMSReplicationSubnetGroupSpecification.json#L22
    "AWS::DMS::ReplicationSubnetGroup": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationsubnetgroup.html",
      "Properties": {
        "ReplicationSubnetGroupDescription": {
          "Required": true,
          "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationsubnetgroup.html#cfn-dms-replicationsubnetgroup-replicationsubnetgroupdescription",

Parameters

Explanation in CloudFormation Registry

The AWS::DMS::ReplicationSubnetGroup resource creates an AWS DMS replication subnet group. Subnet groups must contain at least two subnets in two different Availability Zones in the same region.

Note Resource creation will fail if the dms-vpc-role IAM role doesn't already exist. For more information, see Creating the IAM Roles to Use With the AWS CLI and AWS DMS API in the *AWS Database Migration Service User Guide.

Frequently asked questions

What is AWS DMS Replication Subnet Group?

AWS DMS Replication Subnet Group is a resource for DMS of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS DMS Replication Subnet Group?

For Terraform, the devopsbynaresh/datalake-alsac and niveklabs/aws source code examples are useful. See the Terraform Example section for further details.

For CloudFormation, the alesabater/customer360, aws-samples/aws-service-catalog-for-data-lake-hydration and OmarKhayyam/data-lake-ws source code examples are useful. See the CloudFormation Example section for further details.