Creates a DHCP options set.
Operation description
- CreateDhcpOptionsSet is an asynchronous operation. After you invoke this operation, the system returns an instance ID but the DHCP options set is not yet created. The background node is still in progress. You can invoke GetDhcpOptionsSet to query the creation status of the DHCP options set:
If the vSwitch is in the Pending state, the DHCP options set is being configured.
If the vSwitch is in the Available state, the DHCP options set is active.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
vpc:CreateDhcpOptionsSet |
create |
*DhcpOptionsSet
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region where the DHCP options set resides. You can call DescribeRegions to query the region ID. |
cn-hangzhou |
| DomainNameServers |
string |
No |
The IP addresses of DNS servers. You can specify up to four DNS server IP addresses. Separate multiple IP addresses with commas (,). Note
If you do not specify DNS server IP addresses, ECS instances use the DNS server IP addresses provided by Alibaba Cloud by default (100.100.2.136 and 100.100.2.138). |
192.XX.XX.123 |
| DhcpOptionsSetName |
string |
No |
The name of the DHCP options set. The name must be 1 to 128 characters in length and must start with a letter or Chinese character. It can contain digits, underscores (_), and hyphens (-). |
name |
| DhcpOptionsSetDescription |
string |
No |
The description of the DHCP options set. The description can be empty or 1 to 256 characters in length. It must start with a letter or Chinese character and cannot start with |
description |
| DomainName |
string |
No |
The hostname suffix. Example: example.com. After the DHCP options set is associated with a VPC, the hostname suffix is automatically synchronized to the ECS instances in the associate VPC. |
example.com |
| ResourceGroupId |
string |
No |
The ID of the resource group to which the DHCP options set belongs. |
rg-acfmxazb4ph**** |
| Tag |
array<object> |
No |
The tags of the resource. |
|
|
object |
No |
The tag. |
||
| Key |
string |
No |
The tag key of the resource. You can specify up to 20 tag keys. The tag key cannot be an empty string. A tag key can be up to 128 characters in length. It cannot start with |
FinanceDept |
| Value |
string |
No |
The tag value of the resource. You can specify up to 20 tag values. The tag value can be an empty string. The tag value can be up to 128 characters in length. It cannot start with |
FinanceJoshua |
| ClientToken |
string |
No |
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 ClientToken value can contain only ASCII characters. Note
If you do not specify this parameter, the system automatically uses the RequestId of the API request as the ClientToken. The RequestId may be different for each API request. |
0c593ea1-3bea-11e9-b96b-88e9fe637760 |
| DryRun |
boolean |
No |
Specifies whether to perform a dry run. Valid values: true: performs a dry run. The system checks the required parameters, request syntax, and limits. If the request fails the dry run, an error message is returned. If the request passes the dry run, the false (default): performs a dry run and sends the request. If the request passes the dry run, an HTTP 2xx status code is returned and the DHCP options set is created. |
false |
| LeaseTime |
string |
No |
The lease time of the IPv4 DHCP options set.
Note
You must include the unit when specifying the value. |
3650d |
| Ipv6LeaseTime |
string |
No |
The lease time of the IPv6 DHCP options set.
Note
You must include the unit when specifying the value. |
3650d |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The ID of the DHCP options set that is created. |
||
| DhcpOptionsSetId |
string |
The ID of the DHCP options set that is created. |
dopt-o6w0df4epg9zo8isy**** |
| RequestId |
string |
The request ID. |
0ED8D006-F706-4D23-88ED-E11ED28DCAC0 |
| ResourceGroupId |
string |
The ID of the resource group to which the DHCP options set belongs. |
rg-acfmxazb4ph**** |
Examples
Success response
JSON format
{
"DhcpOptionsSetId": "dopt-o6w0df4epg9zo8isy****",
"RequestId": "0ED8D006-F706-4D23-88ED-E11ED28DCAC0",
"ResourceGroupId": "rg-acfmxazb4ph****"
}
Error codes
|
HTTP status code |
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. |
| 400 | IllegalParam.DomainName | The specified DomainName is invalid. | The error message returned because DomainName is set to an invalid value. |
| 400 | IllegalParam.DhcpOptionsSetName | The specified DhcpOptionsSetName is invalid. | DhcpOptionsSetName is set to an invalid value. |
| 400 | IllegalParam.DhcpOptionsSetDescription | The specified DhcpOptionsSetDescription is invalid. | DhcpOptionsSetDescription is set to an invalid value. |
| 400 | QuotaExceeded.RegionDhcpOptionsSet | The quota of dhcpOptionsSet in the region is exceeded. | The number of DHCP options sets reaches the upper limit. |
| 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. |
| 400 | IllegalParam.LeaseTime | LeaseTime [%s] is illegal. | The specified LeaseTime parameter is illegal |
| 400 | InvalidRegionId.NotFound | The specified RegionId does not exist. | The specified region does not exist. |
| 400 | IllegalParam.Ipv6LeaseTime | Ipv6LeaseTime [%s] is illegal. | The specified Ipv6LeaseTime parameter is illegal |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.