You can call this operation to modify the association of a DHCP options set with a VPC network.

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 ReplaceVpcDhcpOptionsSet

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

DhcpOptionsSetId String Yes dopt-o6w0df4epg9zo8isy****

The ID of the DHCP options set to be modified.

RegionId String Yes cn-hangzhou

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

VpcId String Yes vpc-dsferghthth****

The ID of the associated VPC network to be modified.

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 changing the association of the DHCP options set with the VPC network. The system checks whether your AccessKey pair is valid, whether the RAM user is authorized, and whether required parameters are specified. 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): Runs a precheck and returns a 2XX HTTP status code. After the precheck is complete, the association is modified.

Response parameters

Parameter Type Example Description
RequestId String 0ED8D006-F706-4D23-88ED-E11ED28DCAC0

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/? Action=ReplaceVpcDhcpOptionsSet
&DhcpOptionsSetId=dopt-o6w0df4epg9zo8isy****
&RegionId=cn-hangzhou
&VpcId=vpc-dsferghthth****
&<Common request parameters>

Sample success responses

XML format

<ReplaceVpcDhcpOptionsSetResponse>    
        <RequestId>4DAD3F76-2DB8-4336-B847-D7C0446C7952</RequestId>
</ReplaceVpcDhcpOptionsSetResponse>

JSON format

{
  "RequestId": "4DAD3F76-2DB8-4336-B847-D7C0446C7952"
}

Error codes

HTTP status code Error code Error message Description
400 OperationFailed.AttachmentNotExist The current VPC is not attached to a DHCP options set. The error message returned because the VPC network is not associated with a DHCP options set. You cannot modify the association.
400 IncorrectStatus.VpcDhcpOptionsSet The dhcpOptionsSet status of VPC does not support this operation. The error message returned because the DHCP options set that is associated with the VPC network is being configured. As a result, the DHCP options set does not support this operation.
400 AttrMismatching.VpcDhcpOptionsSetId The dhcpOptionsSetId does not match the VPC. The ID of the DHCP options set does not match the VPC network. Verify that the specified DHCP options set is the one associated with the VPC network.
400 TaskConflict The operation is too frequent. Please wait a moment and try again. The error message returned because the system is busy. Try again later.
400 InvalidVpcId.NotFound Specified value of VpcId is not found in our record. The error message returned because the specified VPC network does not exist. Check whether the specified VPC network ID is valid.
404 InvalidRegionId.NotFound The specified RegionId does not exist. The error message returned because the specified region ID does not exist. Check whether the specified region ID is valid.
400 InvalidDhcpOptionsSetId.NotFound The specified dhcpOptionsSetId does not exist. The error message returned because the DHCP options set does not exist. Check whether the parameter is valid.

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