Calls the AttachDhcpOptionsSetToVpc operation to attach a DHCP options set to a VPC.
Operation description
- AttachDhcpOptionsSetToVpc is an asynchronous operation. After you send a request, the system returns a request ID, but the DHCP options set is not yet attached to the VPC. The attachment task is still running in the background. You can call DescribeVpcAttribute to query the attachment status of the DHCP options set:
If the DHCP options set is in the Pending state, the DHCP options set is being attached.
If the DHCP options set is in the InUse state, the DHCP options set is attached.
AttachDhcpOptionsSetToVpc does not support concurrent attachment of DHCP options sets to the same VPC.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
vpc:AttachDhcpOptionsSetToVpc |
update |
*DhcpOptionsSet
*VPC
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region where the DHCP options set resides. You can call the DescribeRegions operation to query the region ID. |
cn-hangzhou |
| DhcpOptionsSetId |
string |
Yes |
The ID of the DHCP options set. |
dopt-o6w0df4epg9zo8isy**** |
| VpcId |
string |
Yes |
The ID of the VPC to which you want to attach the DHCP options set. |
vpc-sfdkfdjkdf**** |
| 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 uses the RequestId as the ClientToken. The RequestId may differ 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 associating the DHCP options set with the associate VPC. The system checks the request for potential issues, including whether the AccessKey is valid, the authorization of the Resource Access Management (RAM) user, and whether required parameters are specified. If the check fails, the corresponding error is returned. If the check succeeds, the false (default): sends a normal request. If the check succeeds, a 2XX HTTP status code is returned and the DHCP options set is associated with the VPC. |
false |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| 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 | Forbidden.OperateShareResource | You cannot operate shared resources. | Shared resources do not support this operation. |
| 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 | InvalidVpcId.NotFound | Specified value of VpcId is not found in our record. | |
| 400 | IncorrectStatus.VpcDhcpOptionsSet | The dhcpOptionsSet status of VPC 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. |
| 400 | OperationFailed.AttachmentExist | The current VPC is already attached to a DHCP options set. | The VPC is associated with a DHCP options set. You can associate a VPC with only one DHCP options set. |
| 400 | QuotaExceeded.AttachVpcNumber | The maximum number of VPCs that can be attached to a DHCP options set is exceeded. | The number of VPCs that can be associated with a DHCP options set reaches the upper limit. |
| 400 | TaskConflict | The operation is too frequent. Please wait a moment and try again. | The system is unavailable. Try again later. |
| 400 | MissingParam.VpcId | You must specify VpcId. | You must specify VpcId. |
| 400 | MissingParam.DhcpOptionsSetId | Missing parameter DhcpOptionsSetId. | Missing parameter DhcpOptionsSetId |
| 400 | InvalidRegionId.NotFound | The specified RegionId does not exist. | The specified region does not exist. |
| 400 | IncorrectStatus.VpcDnsHostnameStatus | The DnsHostname status of vpc does not support this operation. | The private domain name status of the current VPC does not support this operation. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.