Skip to content

disassociate_route_table async

disassociate_route_table(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    dry_run: Optional[Boolean] = None,
    association_id: Optional[RouteTableAssociationId] = None,
) -> None

Disassociates a subnet or gateway from a route table.

After you perform this action, the subnet no longer uses the routes in the route table. Instead, it uses the routes in the VPC's main route table. For more information about route tables, see Route tables in the Amazon VPC User Guide.

Parameters:

  • dry_run (Optional[Boolean], default: None ) –

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • association_id (Optional[RouteTableAssociationId], default: None ) –

    The association ID representing the current association between the route table and subnet or gateway.

Raises:

Examples:

To disassociate a route table This example disassociates the specified route table from its associated subnet.

>>> await client.disassociate_route_table(association_id='rtbassoc-781d0d1a')
Source code in docs_src/capo_ec2/_services/async_ec2.py
async def disassociate_route_table(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    association_id: Optional[
        "capo_ec2.types.route_table_association_id.RouteTableAssociationId"
    ] = None,
) -> None:
    """<p>Disassociates a subnet or gateway from a route table.</p> <p>After you perform this action, the subnet no longer uses the routes in the route table. Instead, it uses the routes in the VPC's main route table. For more information about route tables, see <a href="https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Route_Tables.html">Route tables</a> in the <i>Amazon VPC User Guide</i>.</p>

    Args:
        dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
        association_id: <p>The association ID representing the current association between the route table and subnet or gateway.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To disassociate a route table
        This example disassociates the specified route table from its associated subnet.

        >>> await client.disassociate_route_table(association_id='rtbassoc-781d0d1a')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.disassociate_route_table_request.DisassociateRouteTableRequest]",
    ) -> AsyncOperationResponse[None]:
        import capo_ec2._operations.amazon_ec2.disassociate_route_table

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.disassociate_route_table.async_disassociate_route_table(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DisassociateRouteTable")
    )
    input_: capo_ec2.types.disassociate_route_table_request.DisassociateRouteTableRequest = {}
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if association_id is not None:
        input_["association_id"] = association_id

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