You can call this operation to create a DHCP options set.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateDhcpOptionsSet

The operation that you want to perform. Set the value to CreateDhcpOptionsSet.

DomainNameServers String Yes 192.xx.xx.123

The DNS server IP addresses. Up to four DNS server IP addresses can be specified. IP addresses must be separated with commas (,).

Note Before you specify any DNS server IP address, all ECS instances in the associated VPC network use the IP addresses of the Alibaba Cloud DNS servers, which are 100.100.2.136 and 100.100.2.138.
RegionId String Yes cn-hangzhou

The region where the DHCP options set is deployed. You can call the DescribeRegions operation to query region IDs.

DhcpOptionsSetName String No test

The name of the DHCP options set.

The name must be 2 to 128 characters in length and can contain letters, Chinese characters, digits, underscores (_), and hyphens (-). It must start with a letter or a Chinese character.

DhcpOptionsSetDescription String No test

The description of the DHCP options set.

The description must be 2 to 256 characters in length and cannot start with http:// or https://.

DomainName String No example.com

The root domain, for example, example.com.

After a DHCP options set is associated with a Virtual Private Cloud (VPC) network, the root domain in the DHCP options set is automatically synchronized to the ECS instances in the VPC network.

ClientToken String No 0c593ea1-3bea-11e9-b96b-88e9fe637760

The client token that is used to ensure the idempotence of the request. You can use the client to generate a value that is unique among different requests. ClientToken supports only ASCII characters.

It can contain up to 64 ASCII characters.

DryRun Boolean No false

Specifies whether to precheck this request only. Valid values:

true: Runs a precheck without creating the DHCP options set. The system checks the format of the request, whether the required parameters are specified, and whether the limits of DHCP options sets are reached. An error message is returned if the request fails the precheck. If the request passes the precheck, the DryRunOperation error code is returned.

false (default value): The DHCP options set is created after the request passes the precheck.

Response parameters

Parameter Type Example Description
DhcpOptionsSetId String dopt-o6w0df4epg9zo8isy****

The ID of the DHCP options set that is created.

RequestId String 0ED8D006-F706-4D23-88ED-E11ED28DCAC0

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/? Action=CreateDhcpOptionsSet
&DomainNameServers=192.xx.xx.123
&RegionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

<CreateDhcpOptionsSetResponse>
      <RequestId>8B2F5262-6B57-43F2-97C4-971425462DFE</RequestId>
      <DhcpOptionsSetId>dopt-o6w0df4epg9zo8isy****</DhcpOptionsSetId>
</CreateDhcpOptionsSetResponse>

JSON format

{
    "DhcpOptionsSetId":"dopt-o6w0df4epg9zo8isy****",
    "RequestId":"0ED8D006-F706-4D23-88ED-E11ED28DCAC0"
}

Error codes

For a list of error codes, visit the API Error Center.