associate_route_table
(**kwargs)¶Associates a subnet in your VPC or an internet gateway or virtual private gateway attached to your VPC with a route table in your VPC. This association causes traffic from the subnet or gateway to be routed according to the routes in the route table. The action returns an association ID, which you need in order to disassociate the route table later. A route table can be associated with multiple subnets.
For more information, see Route tables in the Amazon Virtual Private Cloud User Guide .
See also: AWS API Documentation
Request Syntax
response = client.associate_route_table(
DryRun=True|False,
RouteTableId='string',
SubnetId='string',
GatewayId='string'
)
DryRunOperation
. Otherwise, it is UnauthorizedOperation
.[REQUIRED]
The ID of the route table.
dict
Response Syntax
{
'AssociationId': 'string',
'AssociationState': {
'State': 'associating'|'associated'|'disassociating'|'disassociated'|'failed',
'StatusMessage': 'string'
}
}
Response Structure
(dict) --
AssociationId (string) --
The route table association ID. This ID is required for disassociating the route table.
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 specified subnet.
response = client.associate_route_table(
RouteTableId='rtb-22574640',
SubnetId='subnet-9d4a7b6',
)
print(response)
Expected Output:
{
'AssociationId': 'rtbassoc-781d0d1a',
'ResponseMetadata': {
'...': '...',
},
}