Associates a subnet with a route table. The subnet and route table must be in the same VPC. This association causes traffic originating from the subnet to be routed according to the routes in the route table. The action returns an association ID, which you need if you want to disassociate the route table from the subnet later. A route table can be associated with multiple subnets.
For more information about route tables, go to Route Tables in the Amazon Virtual Private Cloud User Guide.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Required |
The ID of the subnet. |
|
|
Required |
The ID of the route table. |
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
A |
Examples
Associate a VPC route table with a subnet.
$ec2 = new AmazonEC2(); $response = $ec2->associate_route_table('subnet-cd8a0aa4', 'rtb-2c8a0a45'); var_dump($response->isOK());Result:
bool(true)
Related Methods
Source
Method defined in services/ec2.class.php | Toggle source view (8 lines) | View on GitHub