All Products
Search
Document Center

:CreateDhcpOptionsSet

最終更新日:Aug 21, 2023

Creates 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.

RegionId String Yes cn-hangzhou

The region to which the DHCP options set belongs.

You can call the DescribeRegions operation to query the most recent region list.

DomainNameServers String Yes 192.XX.XX.123

The IP address of the DNS server. You can enter at most four DNS server IP addresses. Separate IP addresses with commas (,).

Note If you do not specify a DNS server IP address, Elastic Compute Service (ECS) instances use the IP addresses of the Alibaba Cloud DNS servers, which are 100.100.2.136 and 100.100.2.138.
DhcpOptionsSetName String No name

The name of the DHCP options set.

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

DhcpOptionsSetDescription String No description

The description of the DHCP options set.

The description must be 1 to 256 characters in length. It must start with a letter and cannot start with http:// or https://.

DomainName String No example.com

The root domain. For example, you can set the value to example.com.

After a DHCP options set is associated with a virtual private cloud (VPC), the root domain in the DHCP options set is automatically synchronized with the Elastic Compute Service (ECS) instances in the VPC.

ResourceGroupId String No rg-acfmxazb4ph****

The ID of the resource group to which the DHCP options set belongs.

Tag.N.Key String No FinanceDept

The key of tag N to add to the resource. You can specify at most 20 tag keys. The tag key cannot be an empty string.

The tag key can be at most 128 characters in length. It cannot start with aliyun or acs:, and cannot contain http:// or https://.

Tag.N.Value String No FinanceJoshua

The value of tag N to add to the resource. You can specify at most 20 tag values. The tag value can be an empty string.

The tag value can be up to 128 characters in length, and cannot contain http:// or https://. The tag value cannot start with aliyun or acs:.

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 the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters.

Note If you do not specify this parameter, the system automatically uses the request ID as the client token. The request ID may be different for each request.
DryRun Boolean No false

Specifies whether to perform only a dry run, without performing the actual request. Valid values:

true: performs only a dry run. The system checks the request for potential issues, including missing parameter values, incorrect request syntax, and service limits. If the request fails dry run, an error message is returned. If the request passes the dry run, the DryRunOperation error code is returned.

false (default): performs a dry run and sends the request. If the request passes the dry run, a 2xx HTTP status code is returned and the operation is performed.

LeaseTime String No 3650d

The lease time of the IPv4 addresses for the DHCP options set.

  • If you use hours as the unit, valid values are 24h to 1176h and 87600h to 175200h. Default value: 87600h.
  • If you use days as the unit, valid values are 1d to 49d and 3650d to 7300d. Default value: 3650d.
Note When you specify a value, you must also specify the unit.
Ipv6LeaseTime String No 3650d

The lease time of the IPv6 addresses for the DHCP options set.

  • If you use hours as the unit, valid values are 24h to 1176h and 87600h to 175200h. Default value: 87600h.
  • If you use days as the unit, valid values are 1d to 49d and 3650d to 7300d. Default value: 3650d.
Note When you specify a value, you must also specify the unit.

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 request ID.

ResourceGroupId String rg-acfmxazb4ph****

The ID of the resource group to which the DHCP options set belongs.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateDhcpOptionsSet
&RegionId=cn-hangzhou
&DomainNameServers=192.XX.XX.123
&DhcpOptionsSetName=name
&DhcpOptionsSetDescription=description
&DomainName=example.com
&ResourceGroupId=rg-acfmxazb4ph****
&Tag=[{"Key":"FinanceDept","Value":"FinanceJoshua"}]
&ClientToken=0c593ea1-3bea-11e9-b96b-88e9fe637760
&DryRun=false
&LeaseTime=3650d
&Ipv6LeaseTime=3650d
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateDhcpOptionsSetResponse>
    <DhcpOptionsSetId>dopt-o6w0df4epg9zo8isy****</DhcpOptionsSetId>
    <RequestId>0ED8D006-F706-4D23-88ED-E11ED28DCAC0</RequestId>
    <ResourceGroupId>rg-acfmxazb4ph****</ResourceGroupId>
</CreateDhcpOptionsSetResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

HttpCode Error code Error message Description
400 OperationUnsupported.DhcpOptionsSet The DHCP options set feature in this region is not supported. The current region does not support the DHCP options sets feature.
400 InvalidDomainNameServers.Malformed The specified format of DomainNameServers is invalid. The format of the value of DomainNameServers is invalid. Check whether the parameter is set to a valid value.
400 QuotaExceeded.DomainNameServers The maximum number of domain name servers cannot exceed 4. DomainNameServers is set to a value greater than four.
400 IllegalParam.DomainNameServers The specified DomainNameServers is invalid. DomainNameServers is set to an invalid value. Check whether the parameter is set to a valid value.
400 IllegalParam.DomainName The specified DomainName is invalid. DomainName is set to an invalid value.
400 IllegalParam.DhcpOptionsSetName The specified DhcpOptionsSetName is invalid. DhcpOptionsSetName is set to an invalid value. Check whether the parameter is set to a valid value.
400 IllegalParam.DhcpOptionsSetDescription The specified DhcpOptionsSetDescription is invalid. DhcpOptionsSetDescription is set to an invalid value. Check whether the parameter is set to a valid value.
400 QuotaExceeded.RegionDhcpOptionsSet The quota of dhcpOptionsSet in the region is exceeded. The number of DHCP options sets reaches the upper limit.
400 IllegalParam.ResourceGroupId Invalid ResourceGroupld value. The specified resource group is invalid or does not exist.
400 OperationUnsupported.DhcpLeaseTime The DhcpOptionsSet of this region does not support custom LeaseTime. DHCP options sets in the region do not support a custom lease time.
404 InvalidRegionId.NotFound The specified RegionId does not exist. The specified region does not exist. Check whether the region ID is valid.

For a list of error codes, see Service error codes.