aws ec2 associate-route-table
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. AWS CLI reference
1 example 5 options Its page in the AWS CLI reference
Examples
To associate a route table with a subnet
The following associate-route-table example associates the specified route table with the specified subnet.
aws ec2 associate-route-table --route-table-id rtb-22574640 --subnet-id subnet-9d4a7b6cIdentify--route-table-idThe ID of the route table.--subnet-idThe ID of the subnet.Its output
{
"AssociationId": "rtbassoc-781d0d1a"
}For more information, see Subnet route tables in the Amazon VPC User Guide.
Options
--dry-runChecks whether you have the required permissions for the action, without actually making the request, and provides an error response.--gateway-idThe ID of the internet gateway or virtual private gateway.--public-ipv4-poolThe ID of a public IPv4 pool.--route-table-idThe ID of the route table.--subnet-idThe ID of the subnet.