All Products
Search
Document Center

Virtual Private Cloud:CreateDhcpOptionsSet

Last Updated:May 14, 2024

Creates a DHCP options set.

Operation description

  • CreateDhcpOptionsSet is an asynchronous operation. After a request is sent, the system returns a request ID and runs the task in the background. You can call GetDhcpOptionsSet to query the status of the task.

    • 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 available.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
vpc:CreateDhcpOptionsSetWrite
  • DhcpOptionsSet
    acs:vpc:{#regionId}:{#accountId}:dhcpoptionsset/*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region to which the DHCP options set belongs.

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

cn-hangzhou
DomainNameServersstringYes

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

Note If no IP address is specified, the Elastic Compute Service (ECS) instance uses the IP addresses 100.100.2.136 and 100.100.2.138, which are provided by Alibaba Cloud by default.
192.XX.XX.123
DhcpOptionsSetNamestringNo

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.

name
DhcpOptionsSetDescriptionstringNo

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://.

description
DomainNamestringNo

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 ECS instances in the VPC.

example.com
ResourceGroupIdstringNo

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

rg-acfmxazb4ph****
Tagobject []No

The tag of the resource.

KeystringNo

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

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

FinanceDept
ValuestringNo

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

FinanceJoshua
ClientTokenstringNo

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 client 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.
0c593ea1-3bea-11e9-b96b-88e9fe637760
DryRunbooleanNo

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

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.

false
LeaseTimestringNo

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 enter a value, you must also specify the unit.
3650d
Ipv6LeaseTimestringNo

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 enter a value, you must also specify the unit.
3650d

Response parameters

ParameterTypeDescriptionExample
object

The ID of the DHCP options set that is created.

DhcpOptionsSetIdstring

The ID of the DHCP options set that is created.

dopt-o6w0df4epg9zo8isy****
RequestIdstring

The request ID.

0ED8D006-F706-4D23-88ED-E11ED28DCAC0
ResourceGroupIdstring

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

rg-acfmxazb4ph****

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400OperationUnsupported.DhcpOptionsSetThe DHCP options set feature in this region is not supported.The current region does not support the DHCP options sets feature.
400InvalidDomainNameServers.MalformedThe 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.
400QuotaExceeded.DomainNameServersThe maximum number of domain name servers cannot exceed 4.DomainNameServers is set to a value greater than four.
400IllegalParam.DomainNameServersThe specified DomainNameServers is invalid.DomainNameServers is set to an invalid value.
400IllegalParam.DomainNameThe specified DomainName is invalid.The error message returned because DomainName is set to an invalid value.
400IllegalParam.DhcpOptionsSetNameThe specified DhcpOptionsSetName is invalid.DhcpOptionsSetName is set to an invalid value.
400IllegalParam.DhcpOptionsSetDescriptionThe specified DhcpOptionsSetDescription is invalid.DhcpOptionsSetDescription is set to an invalid value.
400QuotaExceeded.RegionDhcpOptionsSetThe quota of dhcpOptionsSet in the region is exceeded.The number of DHCP options sets reaches the upper limit.
400OperationUnsupported.DhcpLeaseTimeThe DhcpOptionsSet of this region does not support custom LeaseTime.DHCP options sets in the region do not support a custom lease time.
400IllegalParam.LeaseTimeLeaseTime [%s] is illegal.The specified LeaseTime parameter is illegal
404InvalidRegionId.NotFoundThe specified RegionId does not exist.The specified region does not exist.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-09-27The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    delete Error Codes: 404
2023-09-21The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    delete Error Codes: 404
2023-07-05The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    delete Error Codes: 404
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: Tag
2023-05-18The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    delete Error Codes: 404
2023-03-23The Error code has changed. The request parameters of the API has changed. The response structure of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 404
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: ResourceGroupId
Output ParametersThe response structure of the API has changed.
2021-11-17The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 404
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: LeaseTime
    Added Input Parameters: Ipv6LeaseTime