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

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

  • The username must be 2 to 16 characters in length.
  • The username must start with a lowercase letter and end with a lowercase letter or a digit.
  • The username can contain lowercase letters, digits, and underscores (_).
AccountPassword String Yes testxxxxxx

The password of the account. The password must meet the following requirements:

  • The password must be 6 to 32 characters in length.
  • The password can contain letters, digits, and special characters.
  • The password can contain the following special characters: ! @ # $ % ^ & * ( ) _ + - =
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:

  • Normal: The account is a standard account.
  • Admin: The account is an administrator account.

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.