Creates an account with the specified permissions for an ApsaraDB for Redis instance.

Note
  • The engine version of the ApsaraDB for Redis instance is Redis 4.0 or later.
  • The ApsaraDB for Redis instance must be in the running state.
  • You can create up to 18 accounts for an ApsaraDB for Redis instance.

For more information about how to perform the corresponding operation in the console, see Manage database accounts.

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 CreateAccount

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

AccountName String Yes demoaccount

The name of the account. The name must be 1 to 16 characters in length and can contain lowercase letters, digits, and underscores (_). It must start with a lowercase letter.

AccountPassword String Yes uWonno21****

The password of the account. The password must be 8 to 32 characters in length and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Special characters include !@#$%^&*()_+-=.

InstanceId String Yes r-bp1zxszhcgatnx****

The ID of the instance.

AccountPrivilege String No RoleReadOnly

The permissions that you want to grant to the account. Valid values:

  • RoleReadOnly: The account has the read-only permissions.
  • RoleReadWrite: The account has the read and write permissions. This is the default value.
AccountDescription String No testaccount

The description of the account.

  • It must start with a Chinese character or a letter and cannot start with http:// or https://.
  • It can contain letters, digits, underscores (_), and hyphens (-).
  • It must be 2 to 256 characters in length.
AccountType String No Normal

The type of the account. Set the value to Normal.

RegionId String No cn-hangzhou

The ID of the region where the instance is deployed.

Response parameters

Parameter Type Example Description
AcountName String demoaccount

The name of the account.

InstanceId String r-bp1zxszhcgatnx****

The ID of the instance.

RequestId String ABAF95F6-35C1-4177-AF3A-70969EBD****

The ID of the request.

Examples

Sample requests

https://r-kvstore.aliyuncs.com/?Action=CreateAccount
&AccountName=demoaccount
&AccountPassword=uWonno21****
&InstanceId=r-bp1zxszhcgatnx****
&<Common request parameters>

Sample success responses

XML format

<CreateAccountResponse>
      <RequestId>D3876765-1983-4CBC-BB45-79EEBD6D****</RequestId>
      <InstanceId>r-bp1zxszhcgatnx****</InstanceId>
      <AcountName>demoaccount</AcountName>
</CreateAccountResponse>

JSON format

{
	"RequestId": "D3876765-1983-4CBC-BB45-79EEBD6D****",
	"InstanceId": "r-bp1zxszhcgatnx****",
	"AcountName": "demoaccount"
}

Error codes

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