create_dhcp_options ( $dhcp_configuration, $opt )

Creates a set of DHCP options that you can then associate with one or more VPCs, causing all existing and new instances that you launch in those VPCs to use the set of DHCP options. The following table lists the individual DHCP options you can specify. For more information about the options, go to http://www.ietf.org/rfc/rfc2132.txt

Access

public

Parameters

Parameter

Type

Required

Description

$dhcp_configuration

array

Required

A set of one or more DHCP configurations.

  • x - array - Optional - This represents a simple array index.
    • Key - string - Optional - Contains the name of a DHCP option.
    • Value - string|array - Optional - Contains a set of values for a DHCP option. Pass a string for a single value, or an indexed array for multiple values.

$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

Create a new set of DHCP options.

$ec2 = new AmazonEC2();

$response = $ec2->create_dhcp_options(array(
	array('Key' => 'domain-name',         'Value' => 'example.com'),
	array('Key' => 'ntp-servers',         'Value' => '140.142.16.34'),
	array('Key' => 'domain-name-servers', 'Value' => array('8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.222.220')),
));

var_dump($response->isOK());
Result:
bool(true)

Related Methods

Source

Method defined in services/ec2.class.php | Toggle source view (11 lines) | View on GitHub

public function create_dhcp_options($dhcp_configuration, $opt = null)
{
    if (!$opt) $opt = array();
            
    // Required list + map
    $opt = array_merge($opt, CFComplexType::map(array(
        'DhcpConfiguration' => (is_array($dhcp_configuration) ? $dhcp_configuration : array($dhcp_configuration))
    )));

    return $this->authenticate('CreateDhcpOptions', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback