replace_route_table_association

EC2.Client.replace_route_table_association(**kwargs)

Changes the route table associated with a given subnet, internet gateway, or virtual private gateway in a VPC. After the operation completes, the subnet or gateway uses the routes in the new route table. For more information about route tables, see Route tables in the Amazon Virtual Private Cloud User Guide .

You can also use this operation to change which table is the main route table in the VPC. Specify the main route table's association ID and the route table ID of the new main route table.

See also: AWS API Documentation

Request Syntax

response = client.replace_route_table_association(
    AssociationId='string',
    DryRun=True|False,
    RouteTableId='string'
)
Parameters
  • AssociationId (string) --

    [REQUIRED]

    The association ID.

  • DryRun (boolean) -- 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 .
  • RouteTableId (string) --

    [REQUIRED]

    The ID of the new route table to associate with the subnet.

Return type

dict

Returns

Response Syntax

{
    'NewAssociationId': 'string',
    'AssociationState': {
        'State': 'associating'|'associated'|'disassociating'|'disassociated'|'failed',
        'StatusMessage': 'string'
    }
}

Response Structure

  • (dict) --

    • NewAssociationId (string) --

      The ID of the new association.

    • AssociationState (dict) --

      The state of the association.

      • State (string) --

        The state of the association.

      • StatusMessage (string) --

        The status message, if applicable.

Examples

This example associates the specified route table with the subnet for the specified route table association.

response = client.replace_route_table_association(
    AssociationId='rtbassoc-781d0d1a',
    RouteTableId='rtb-22574640',
)

print(response)

Expected Output:

{
    'NewAssociationId': 'rtbassoc-3a1f0f58',
    'ResponseMetadata': {
        '...': '...',
    },
}