Skip to content

modify_db_subnet_group async

modify_db_subnet_group(
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_subnet_group_name: Optional[String] = None,
    db_subnet_group_description: Optional[String] = None,
    subnet_ids: Optional[SubnetIdentifierList] = None,
) -> ModifyDBSubnetGroupResult

Modifies an existing DB subnet group. DB subnet groups must contain at least one subnet in at least two AZs in the Amazon Web Services Region.

Parameters:

  • db_subnet_group_name (Optional[String], default: None ) –

    The name for the DB subnet group. This value is stored as a lowercase string. You can't modify the default subnet group.

    Constraints: Must match the name of an existing DBSubnetGroup. Must not be default.

    Example: mydbsubnetgroup

  • db_subnet_group_description (Optional[String], default: None ) –

    The description for the DB subnet group.

  • subnet_ids (Optional[SubnetIdentifierList], default: None ) –

    The EC2 subnet IDs for the DB subnet group.

Raises:

Examples:

To modify a DB subnet group The following example adds a subnet with the ID subnet-08e41f9e230222222 to the DB subnet group named mysubnetgroup. To keep the existing subnets in the subnet group, include their IDs as values in the --subnet-ids option. Make sure to have subnets with at least two different Availability Zones in the DB subnet group.

>>> await client.modify_db_subnet_group(db_subnet_group_name='mysubnetgroup', db_subnet_group_description='', subnet_ids=['subnet-0a1dc4e1a6f123456', 'subnet-070dd7ecb3aaaaaaa', 'subnet-00f5b198bc0abcdef', 'subnet-08e41f9e230222222'])
Source code in docs_src/capo_rds/_services/async_rds.py
async def modify_db_subnet_group(
    self,
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_subnet_group_name: Optional["capo_rds.types.string.String"] = None,
    db_subnet_group_description: Optional["capo_rds.types.string.String"] = None,
    subnet_ids: Optional[
        "capo_rds.types.subnet_identifier_list.SubnetIdentifierList"
    ] = None,
) -> "capo_rds.types.modify_db_subnet_group_result.ModifyDBSubnetGroupResult":
    """<p>Modifies an existing DB subnet group. DB subnet groups must contain at least one subnet in at least two AZs in the Amazon Web Services Region.</p>

    Args:
        db_subnet_group_name: <p>The name for the DB subnet group. This value is stored as a lowercase string. You can't modify the default subnet group.</p> <p>Constraints: Must match the name of an existing DBSubnetGroup. Must not be default.</p> <p>Example: <code>mydbsubnetgroup</code> </p>
        db_subnet_group_description: <p>The description for the DB subnet group.</p>
        subnet_ids: <p>The EC2 subnet IDs for the DB subnet group.</p>

    Raises:
        capo_rds.errors.db_subnet_group_does_not_cover_enough_a_zs.DBSubnetGroupDoesNotCoverEnoughAZs: <p>Subnets in the DB subnet group should cover at least two Availability Zones unless there is only one Availability Zone.</p>
        capo_rds.errors.db_subnet_group_not_found_fault.DBSubnetGroupNotFoundFault: <p> <code>DBSubnetGroupName</code> doesn't refer to an existing DB subnet group.</p>
        capo_rds.errors.db_subnet_quota_exceeded_fault.DBSubnetQuotaExceededFault: <p>The request would result in the user exceeding the allowed number of subnets in a DB subnet groups.</p>
        capo_rds.errors.invalid_db_subnet_group_state_fault.InvalidDBSubnetGroupStateFault: <p>The DB subnet group cannot be deleted because it's in use.</p>
        capo_rds.errors.invalid_subnet.InvalidSubnet: <p>The requested subnet is invalid, or multiple subnets were requested that are not all in a common VPC.</p>
        capo_rds.errors.subnet_already_in_use.SubnetAlreadyInUse: <p>The DB subnet is already in use in the Availability Zone.</p>
        capo_rds.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To modify a DB subnet group
        The following example adds a subnet with the ID subnet-08e41f9e230222222 to the DB subnet group named mysubnetgroup. To keep the existing subnets in the subnet group, include their IDs as values in the --subnet-ids option. Make sure to have subnets with at least two different Availability Zones in the DB subnet group.

        >>> await client.modify_db_subnet_group(db_subnet_group_name='mysubnetgroup', db_subnet_group_description='', subnet_ids=['subnet-0a1dc4e1a6f123456', 'subnet-070dd7ecb3aaaaaaa', 'subnet-00f5b198bc0abcdef', 'subnet-08e41f9e230222222'])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rds.types.modify_db_subnet_group_message.ModifyDBSubnetGroupMessage]",
    ) -> AsyncOperationResponse[
        "capo_rds.types.modify_db_subnet_group_result.ModifyDBSubnetGroupResult"
    ]:
        import capo_rds._operations.amazon_rd_sv19.modify_db_subnet_group

        (
            output,
            http_response,
        ) = await capo_rds._operations.amazon_rd_sv19.modify_db_subnet_group.async_modify_db_subnet_group(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ModifyDBSubnetGroup")
    )
    input_: capo_rds.types.modify_db_subnet_group_message.ModifyDBSubnetGroupMessage = {}
    if db_subnet_group_name is not None:
        input_["db_subnet_group_name"] = db_subnet_group_name
    if db_subnet_group_description is not None:
        input_["db_subnet_group_description"] = db_subnet_group_description
    if subnet_ids is not None:
        input_["subnet_ids"] = subnet_ids

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output