Skip to content

create_replication_subnet_group

create_replication_subnet_group(
    replication_subnet_group_identifier: String,
    replication_subnet_group_description: String,
    subnet_ids: SubnetIdentifierList,
    *,
    config_overrides: Optional[DatabaseMigrationServiceClientConfig] = None,
    tags: Optional[TagList] = None,
) -> CreateReplicationSubnetGroupResponse

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.

Parameters:

  • replication_subnet_group_identifier (String) –

    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, underscores, or hyphens. Must not be "default".

    Example: mySubnetgroup

  • replication_subnet_group_description (String) –

    The description for the subnet group.

    Constraints: This parameter Must not contain non-printable control characters.

  • subnet_ids (SubnetIdentifierList) –

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

  • tags (Optional[TagList], default: None ) –

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

Raises:

Examples:

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

>>> client.create_replication_subnet_group(replication_subnet_group_identifier='us-west-2ab-vpc-215ds366', replication_subnet_group_description='US West subnet group', subnet_ids=['subnet-e145356n', 'subnet-58f79200'], tags=[{'Key': 'Acount', 'Value': '145235'}])
Source code in docs_src/capo_database_migration_service/_services/database_migration_service.py
def create_replication_subnet_group(
    self,
    replication_subnet_group_identifier: "capo_database_migration_service.types.string.String",
    replication_subnet_group_description: "capo_database_migration_service.types.string.String",
    subnet_ids: "capo_database_migration_service.types.subnet_identifier_list.SubnetIdentifierList",
    *,
    config_overrides: Optional[DatabaseMigrationServiceClientConfig] = None,
    tags: Optional["capo_database_migration_service.types.tag_list.TagList"] = None,
) -> "capo_database_migration_service.types.create_replication_subnet_group_response.CreateReplicationSubnetGroupResponse":
    """<p>Creates a replication subnet group given a list of the subnet IDs in a VPC.</p> <p>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 <code>ReplicationSubnetGroupDoesNotCoverEnoughAZs</code> exception.</p> <p>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 <a href="https://docs.aws.amazon.com/en_us/dms/latest/APIReference/API_DeleteReplicationSubnetGroup.html">DeleteReplicationSubnetGroup</a> action. Optionally, choose Subnet groups in the DMS console, then choose your subnet group. Next, choose Delete from Actions.</p>

    Args:
        replication_subnet_group_identifier: <p>The name for the replication subnet group. This value is stored as a lowercase string.</p> <p>Constraints: Must contain no more than 255 alphanumeric characters, periods, underscores, or hyphens. Must not be "default".</p> <p>Example: <code>mySubnetgroup</code> </p>
        replication_subnet_group_description: <p>The description for the subnet group. </p> <p>Constraints: This parameter Must not contain non-printable control characters.</p>
        subnet_ids: <p>Two or more subnet IDs to be assigned to the subnet group.</p>
        tags: <p>One or more tags to be assigned to the subnet group.</p>

    Raises:
        capo_database_migration_service.errors.access_denied_fault.AccessDeniedFault: <p>DMS was denied access to the endpoint. Check that the role is correctly configured.</p>
        capo_database_migration_service.errors.invalid_subnet.InvalidSubnet: <p>The subnet provided isn't valid.</p>
        capo_database_migration_service.errors.replication_subnet_group_does_not_cover_enough_a_zs.ReplicationSubnetGroupDoesNotCoverEnoughAZs: <p>The replication subnet group does not cover enough Availability Zones (AZs). Edit the replication subnet group and add more AZs.</p>
        capo_database_migration_service.errors.resource_already_exists_fault.ResourceAlreadyExistsFault: <p>The resource you are attempting to create already exists.</p>
        capo_database_migration_service.errors.resource_not_found_fault.ResourceNotFoundFault: <p>The resource could not be found.</p>
        capo_database_migration_service.errors.resource_quota_exceeded_fault.ResourceQuotaExceededFault: <p>The quota for this resource quota has been exceeded.</p>
        capo_database_migration_service.errors.UnknownServiceError: The service returned an error code this client does not model.

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

        >>> client.create_replication_subnet_group(replication_subnet_group_identifier='us-west-2ab-vpc-215ds366', replication_subnet_group_description='US West subnet group', subnet_ids=['subnet-e145356n', 'subnet-58f79200'], tags=[{'Key': 'Acount', 'Value': '145235'}])
    """

    def _handler(
        req: "OperationRequest[capo_database_migration_service.types.create_replication_subnet_group_message.CreateReplicationSubnetGroupMessage]",
    ) -> OperationResponse[
        "capo_database_migration_service.types.create_replication_subnet_group_response.CreateReplicationSubnetGroupResponse"
    ]:
        import capo_database_migration_service._operations.amazon_dm_sv20160101.create_replication_subnet_group

        output, http_response = (
            capo_database_migration_service._operations.amazon_dm_sv20160101.create_replication_subnet_group.create_replication_subnet_group(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateReplicationSubnetGroup")
    )
    input_: capo_database_migration_service.types.create_replication_subnet_group_message.CreateReplicationSubnetGroupMessage = {
        "replication_subnet_group_identifier": replication_subnet_group_identifier,
        "replication_subnet_group_description": replication_subnet_group_description,
        "subnet_ids": subnet_ids,
    }
    if tags is not None:
        input_["tags"] = tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output