CreateDhcpOptions - Amazon Elastic Compute Cloud
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

CreateDhcpOptions

Creates a set of DHCP options for your VPC. After creating the set, you must associate it with the VPC, causing all existing and new instances that you launch in the VPC to use this set of DHCP options. The following are the individual DHCP options you can specify. For more information about the options, see RFC 2132.

  • domain-name-servers - The IP addresses of up to four domain name servers, or AmazonProvidedDNS. The default DHCP option set specifies AmazonProvidedDNS. If specifying more than one domain name server, specify the IP addresses in a single parameter, separated by commas. To have your instance receive a custom DNS hostname as specified in domain-name, you must set domain-name-servers to a custom DNS server.

  • domain-name - If you're using AmazonProvidedDNS in us-east-1, specify ec2.internal. If you're using AmazonProvidedDNS in another Region, specify region.compute.internal (for example, ap-northeast-1.compute.internal). Otherwise, specify a domain name (for example, ExampleCompany.com). This value is used to complete unqualified DNS hostnames. Important: Some Linux operating systems accept multiple domain names separated by spaces. However, Windows and other Linux operating systems treat the value as a single domain, which results in unexpected behavior. If your DHCP options set is associated with a VPC that has instances with multiple operating systems, specify only one domain name.

  • ntp-servers - The IP addresses of up to four Network Time Protocol (NTP) servers.

  • netbios-name-servers - The IP addresses of up to four NetBIOS name servers.

  • netbios-node-type - The NetBIOS node type (1, 2, 4, or 8). We recommend that you specify 2 (broadcast and multicast are not currently supported). For more information about these node types, see RFC 2132.

Your VPC automatically starts out with a set of DHCP options that includes only a DNS server that we provide (AmazonProvidedDNS). If you create a set of options, and if your VPC has an internet gateway, make sure to set the domain-name-servers option either to AmazonProvidedDNS or to a domain name server of your choice. For more information, see DHCP options sets in the Amazon VPC User Guide.

Request Parameters

The following parameters are for this specific action. For more information about required and optional parameters that are common to all actions, see Common Query Parameters.

DhcpConfiguration.N

A DHCP configuration option.

Type: Array of NewDhcpConfiguration objects

Required: Yes

DryRun

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Type: Boolean

Required: No

TagSpecification.N

The tags to assign to the DHCP option.

Type: Array of TagSpecification objects

Required: No

Response Elements

The following elements are returned by the service.

dhcpOptions

A set of DHCP options.

Type: DhcpOptions object

requestId

The ID of the request.

Type: String

Errors

For information about the errors that are common to all actions, see Common client error codes.

Examples

Example

This example creates a set of DHCP options with a domain name example.com and two DNS servers (10.2.5.1 and 10.2.5.2). The DNS servers' IP addresses are specified in a single parameter, separated by commas, to preserve the order in which they are specified.

Sample Request

https://ec2.amazonaws.com/?Action=CreateDhcpOptions &DhcpConfiguration.1.Key=domain-name &DhcpConfiguration.1.Value.1=example.com &DhcpConfiguration.2.Key=domain-name-servers &DhcpConfiguration.2.Value.1=10.2.5.1,10.2.5.2 &AUTHPARAMS

Sample Response

<CreateDhcpOptionsResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/"> <requestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</requestId> <dhcpOptions> <dhcpOptionsId>dopt-096c1234cade2dabc</dhcpOptionsId> <dhcpConfigurationSet> <item> <key>domain-name</key> <valueSet> <item> <value>example.com</value> </item> </valueSet> </item> <item> <key>domain-name-servers</key> <valueSet> <item> <value>10.2.5.1</value> </item> <item> <value>10.2.5.2</value> </item> </valueSet> </item> </dhcpConfigurationSet> <tagSet/> </dhcpOptions> </CreateDhcpOptionsResponse>

See Also

For more information about using this API in one of the language-specific Amazon SDKs, see the following: