associate_route_table ( $subnet_id, $route_table_id, $opt )

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

$subnet_id

string

Required

The ID of the subnet.

$route_table_id

string

Required

The ID of the route table.

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

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

public function associate_route_table($subnet_id, $route_table_id, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['SubnetId'] = $subnet_id;
    $opt['RouteTableId'] = $route_table_id;
    
    return $this->authenticate('AssociateRouteTable', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback