DatabaseMigrationService / Client / create_replication_subnet_group

create_replication_subnet_group#

DatabaseMigrationService.Client.create_replication_subnet_group(**kwargs)#

Creates a replication subnet group given a list of the subnet IDs in a VPC.

The VPC needs to have at least one subnet in at least two availability zones in the Amazon Web Services Region, otherwise the service will throw a ReplicationSubnetGroupDoesNotCoverEnoughAZs exception.

If a replication subnet group exists in your Amazon Web Services account, the CreateReplicationSubnetGroup action returns the following error message: The Replication Subnet Group already exists. In this case, delete the existing replication subnet group. To do so, use the DeleteReplicationSubnetGroup action. Optionally, choose Subnet groups in the DMS console, then choose your subnet group. Next, choose Delete from Actions.

See also: AWS API Documentation

Request Syntax

response = client.create_replication_subnet_group(
    ReplicationSubnetGroupIdentifier='string',
    ReplicationSubnetGroupDescription='string',
    SubnetIds=[
        'string',
    ],
    Tags=[
        {
            'Key': 'string',
            'Value': 'string',
            'ResourceArn': 'string'
        },
    ]
)
Parameters:
  • ReplicationSubnetGroupIdentifier (string) –

    [REQUIRED]

    The name for the replication subnet group. This value is stored as a lowercase string.

    Constraints: Must contain no more than 255 alphanumeric characters, periods, spaces, underscores, or hyphens. Must not be “default”.

    Example: mySubnetgroup

  • ReplicationSubnetGroupDescription (string) –

    [REQUIRED]

    The description for the subnet group.

  • SubnetIds (list) –

    [REQUIRED]

    One or more subnet IDs to be assigned to the subnet group.

    • (string) –

  • Tags (list) –

    One or more tags to be assigned to the subnet group.

    • (dict) –

      A user-defined key-value pair that describes metadata added to an DMS resource and that is used by operations such as the following:

      • AddTagsToResource

      • ListTagsForResource

      • RemoveTagsFromResource

      • Key (string) –

        A key is the required name of the tag. The string value can be 1-128 Unicode characters in length and can’t be prefixed with “aws:” or “dms:”. The string can only contain only the set of Unicode letters, digits, white-space, ‘_’, ‘.’, ‘/’, ‘=’, ‘+’, ‘-’ (Java regular expressions: “^([\p{L}\p{Z}\p{N}_.:/=+\-]*)$”).

      • Value (string) –

        A value is the optional value of the tag. The string value can be 1-256 Unicode characters in length and can’t be prefixed with “aws:” or “dms:”. The string can only contain only the set of Unicode letters, digits, white-space, ‘_’, ‘.’, ‘/’, ‘=’, ‘+’, ‘-’ (Java regular expressions: “^([\p{L}\p{Z}\p{N}_.:/=+\-]*)$”).

      • ResourceArn (string) –

        The Amazon Resource Name (ARN) string that uniquely identifies the resource for which the tag is created.

Return type:

dict

Returns:

Response Syntax

{
    'ReplicationSubnetGroup': {
        'ReplicationSubnetGroupIdentifier': 'string',
        'ReplicationSubnetGroupDescription': 'string',
        'VpcId': 'string',
        'SubnetGroupStatus': 'string',
        'Subnets': [
            {
                'SubnetIdentifier': 'string',
                'SubnetAvailabilityZone': {
                    'Name': 'string'
                },
                'SubnetStatus': 'string'
            },
        ],
        'SupportedNetworkTypes': [
            'string',
        ]
    }
}

Response Structure

  • (dict) –

    • ReplicationSubnetGroup (dict) –

      The replication subnet group that was created.

      • ReplicationSubnetGroupIdentifier (string) –

        The identifier of the replication instance subnet group.

      • ReplicationSubnetGroupDescription (string) –

        A description for the replication subnet group.

      • VpcId (string) –

        The ID of the VPC.

      • SubnetGroupStatus (string) –

        The status of the subnet group.

      • Subnets (list) –

        The subnets that are in the subnet group.

        • (dict) –

          In response to a request by the DescribeReplicationSubnetGroups operation, this object identifies a subnet by its given Availability Zone, subnet identifier, and status.

          • SubnetIdentifier (string) –

            The subnet identifier.

          • SubnetAvailabilityZone (dict) –

            The Availability Zone of the subnet.

            • Name (string) –

              The name of the Availability Zone.

          • SubnetStatus (string) –

            The status of the subnet.

      • SupportedNetworkTypes (list) –

        The IP addressing protocol supported by the subnet group. This is used by a replication instance with values such as IPv4 only or Dual-stack that supports both IPv4 and IPv6 addressing. IPv6 only is not yet supported.

        • (string) –

Exceptions

  • DatabaseMigrationService.Client.exceptions.AccessDeniedFault

  • DatabaseMigrationService.Client.exceptions.ResourceAlreadyExistsFault

  • DatabaseMigrationService.Client.exceptions.ResourceNotFoundFault

  • DatabaseMigrationService.Client.exceptions.ResourceQuotaExceededFault

  • DatabaseMigrationService.Client.exceptions.ReplicationSubnetGroupDoesNotCoverEnoughAZs

  • DatabaseMigrationService.Client.exceptions.InvalidSubnet

Examples

Creates a replication subnet group given a list of the subnet IDs in a VPC.

response = client.create_replication_subnet_group(
    ReplicationSubnetGroupDescription='US West subnet group',
    ReplicationSubnetGroupIdentifier='us-west-2ab-vpc-215ds366',
    SubnetIds=[
        'subnet-e145356n',
        'subnet-58f79200',
    ],
    Tags=[
        {
            'Key': 'Acount',
            'Value': '145235',
        },
    ],
)

print(response)

Expected Output:

{
    'ReplicationSubnetGroup': {
    },
    'ResponseMetadata': {
        '...': '...',
    },
}