All Products
Search
Document Center

Virtual Private Cloud:UpdateDhcpOptionsSetAttribute

Last Updated:Aug 17, 2026

Modifies the configuration of a DHCP options set by calling the UpdateDhcpOptionsSetAttribute operation.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

vpc:UpdateDhcpOptionsSetAttribute

update

*DhcpOptionsSet

acs:vpc:{#regionId}:{#accountId}:dhcpoptionsset/{#DhcpOptionsSetId}

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID of the DHCP options set to modify. You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou

DhcpOptionsSetId

string

Yes

The ID of the DHCP options set to modify.

dopt-o6w0df4epg9zo8isy****

DomainNameServers

string

No

The IP addresses of DNS servers. You can specify up to four DNS server IP addresses, separated by commas (,).

Note

If you do not specify any DNS server IP addresses, ECS instances use the DNS server IP addresses provided by Alibaba Cloud (100.100.2.136 and 100.100.2.138) by default.

192.XX.XX.123

DomainName

string

No

The hostname suffix, such as example.com.

After you attach the DHCP options set to an associate VPC, the hostname suffix is automatically synchronized to ECS instances in the VPC.

example.com

DhcpOptionsSetName

string

No

The name of the DHCP options set.

The name must be 2 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 2 to 256 characters in length. It must start with a letter or Chinese character and cannot start with http:// or https://.

description

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 token 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 without modifying the DHCP options set configuration. The system checks the required parameters, request format, and limits. If the request fails the 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, an HTTP 2xx status code is returned and the DHCP options set configuration is modified.

false

LeaseTime

string

No

The lease time of the IPv4 DHCP options set.

  • If the lease time is set in hours, the unit is h. Valid values: 24h to 1176h and 87600h to 175200h. Default value: 87600h.

  • If the lease time is set in days, the unit is d. Valid values: 1d to 49d and 3650d to 7300d. Default value: 3650d.

Note

You must include the unit when specifying the value.

3650d

Ipv6LeaseTime

string

No

The lease time of the IPv6 DHCP options set.

  • If the lease time is set in hours, the unit is h. Valid values: 24h to 1176h and 87600h to 175200h. Default value: 24h.

  • If the lease time is set in days, the unit is d. Valid values: 1d to 49d and 3650d to 7300d. Default value: 1d.

Note

You must include the unit when specifying the value.

3650d

Response elements

Element

Type

Description

Example

object

The request ID.

RequestId

string

The request ID.

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

Examples

Success response

JSON format

{
  "RequestId": "0ED8D006-F706-4D23-88ED-E11ED28DCAC0"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidDhcpOptionsSetId.NotFound The specified dhcpOptionsSetId does not exist. The DHCP options set does not exist. Check whether the parameter is set to a valid value.
400 IncorrectStatus.DhcpOptionsSet The DhcpOptionsSet status does not support this operation. The DHCP options set that is associated with the VPC is being configured. As a result, the DHCP options set does not support this operation. You can perform the operation after the status of the DHCP options set is stable.
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 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 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 OperationDenied.ModifyDefaultDhcpOptionsSet The default DHCP options set is not allowed to be modified. The default DHCP options set is not allowed to be modified.
400 InvalidRegionId.NotFound The specified RegionId does not exist. The specified region does not exist.
400 IllegalParam.LeaseTime LeaseTime [%s] is illegal. The specified LeaseTime parameter is illegal

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.