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.
example
Use a bare-bones client and the command you need to make an API call.
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.
Use a bare-bones client and the command you need to make an API call.
import { EC2Client, AssociateRouteTableCommand } from "@aws-sdk/client-ec2"; // ES Modules import // const { EC2Client, AssociateRouteTableCommand } = require("@aws-sdk/client-ec2"); // CommonJS import const client = new EC2Client(config); const command = new AssociateRouteTableCommand(input); const response = await client.send(command);
AssociateRouteTableCommandInput for command's
input
shape.AssociateRouteTableCommandOutput for command's
response
shape.config for EC2Client's
config
shape.