Creates an account for a host.
Each host can have only one account. Before you create an account for a host, make sure that the existing account of the host is deleted. For more information, see Create an account for a host.
Debugging
Request parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| Action | String | Yes | CreateDedicatedHostAccount |
The operation that you want to perform. Set the value to CreateDedicatedHostAccount. |
| DedicatedHostId | String | Yes | ch-bp10a5id3boqi**** |
The ID of the host. You can call the DescribeDedicatedHosts operation to obtain the ID of the host. |
| AccountName | String | Yes | test |
The username of the account that you want to create.
|
| AccountPassword | String | Yes | testxxxxxx |
The password of the account. The password must meet the following requirements:
Note If the host is used for SQL Server databases, the password cannot include the username
of the account, regardless of lowercase letters or uppercase letters.
|
| RegionId | String | Yes | cn-hangzhou |
The ID of the region where the host is deployed. You can call the DescribeDedicatedHostAttribute operation to obtain the region ID. |
| BastionInstanceId | String | No | bastionhost-cn-xxxxxxxxxxx |
The ID of the bastionhost with which the specified host is associated. In the ApsaraDB MyBase console, you can view the bastionhost ID on the Bastion Hosts page. |
| AccountType | String | No | Admin |
The type of the account. Valid values:
For more information, see Host permissions. |
| ClientToken | String | Yes | ETnLKlblzczshOTUbOCz******* |
The client token that is used to ensure the idempotence of the request. You can use the client to generate a token. Make sure that the value of this parameter is unique among different requests. The token can contain only ASCII characters and can be up to 64 characters in length. |
Response parameters
| Parameter | Type | Example | Description |
|---|---|---|---|
| RequestId | String | D6E068C3-25BC-455A-85FE-45F0B22E12AS |
The ID of the request. |
Examples
Sample requests
http(s)://cddc.aliyuncs.com/?Action=CreateDedicatedHostAccount
&AccountName=test
&AccountPassword=testxxxxxx
&ClientToken=ETnLKlblzczshOTUbOCz*******
&DedicatedHostId=ch-bp10a5id3boqi****
&RegionId=cn-hangzhou
&<Common request parameters>
Sample success responses
XML format
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateDedicatedHostAccountReponse>
<RequestId>D6E068C3-25BC-455A-85FE-45F0B22E12AS</RequestId>
</CreateDedicatedHostAccountReponse>
JSON format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "D6E068C3-25BC-455A-85FE-45F0B22E12AS"
}
Error codes
| HttpCode | Error code | Error message | Description |
|---|---|---|---|
| 400 | InvalidAccountPassword.Format | The account password format is invalid. | The error message returned because the specified password is invalid. |
| 403 | InvalidAction.NotSupport | The host status does not support the operation. | The error message returned because this operation is not supported when the host is in the current state. |
| 404 | HostInfo.NotFound | The host is not found. | The error message returned because the specified host does not exist. |
For a list of error codes, visit the API Error Center.