Skip to content

EC2  >  Operations  >  associate_route_table

associate_route_table

Operation

associate_route_table async

associate_route_table(input: AssociateRouteTableInput, plugins: list[Plugin] | None = None) -> AssociateRouteTableOutput

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 VPC User Guide.

Parameters:

Name Type Description Default
input AssociateRouteTableInput

An instance of AssociateRouteTableInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
AssociateRouteTableOutput

An instance of AssociateRouteTableOutput.

Input

AssociateRouteTableInput dataclass

Bases: _SerdeShape

Dataclass for AssociateRouteTableInput structure.

Attributes

dry_run class-attribute instance-attribute
dry_run: bool | 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.

gateway_id class-attribute instance-attribute
gateway_id: str | None = ...

The ID of the internet gateway or virtual private gateway.

public_ipv4_pool class-attribute instance-attribute
public_ipv4_pool: str | None = ...

The ID of a public IPv4 pool. A public IPv4 pool is a pool of IPv4 addresses that you've brought to Amazon Web Services with BYOIP.

route_table_id class-attribute instance-attribute
route_table_id: str | None = ...

The ID of the route table.

subnet_id class-attribute instance-attribute
subnet_id: str | None = ...

The ID of the subnet.

Output

AssociateRouteTableOutput dataclass

Bases: _SerdeShape

Dataclass for AssociateRouteTableOutput structure.

Attributes

association_id class-attribute instance-attribute
association_id: str | None = ...

The route table association ID. This ID is required for disassociating the route table.

association_state class-attribute instance-attribute
association_state: RouteTableAssociationState | None = ...

The state of the association.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.