You can call this API to create an account with the specified permission for an ApsaraDB for Redis instance.

Note
  • The engine version of the ApsaraDB for Redis instance must be Redis 4.0 or above.
  • The ApsaraDB for Redis instance must be in the running status.
  • A maximum of 18 accounts can be created for an ApsaraDB for Redis instance.

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

Debugging

Alibaba Cloud provides OpenAPI Explorer to simplify API usage. You can use OpenAPI Explorer to search for APIs, call APIs, and dynamically generate SDK example code.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateAccount

The operation that you want to perform. Set this parameter to CreateAccount.

AccountName String Yes demoaccount

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

AccountPassword String Yes uWonno233

The password of the account. The password can be 8 to 32 characters in length and must contain at least three types of the following characters: uppercase letters, lowercase letters, digits, and special characters. Special characters include ! at signs (@), number signs (#), dollar signs ($), percent signs (%), carets (^), ampersands (&), asterisks (*), parentheses (()), underscores (_), plus signs (+), hyphens (-), and equal signs (=).

InstanceId String Yes r-bp1xxxxxxxxxxxxx

The ID of the instance for which you want to create the account.

AccessKeyId String No Lxxxxxxxxxxxxxxw

The AccessKey ID that Alibaba Cloud provides for you to access services.

AccountPrivilege String No RoleReadOnly

The permission of the account. Valid values:

  • RoleReadOnly
  • RoleReadWrite (default value)
  • RoleRepl
Note In addition to reading data from and writing data to the ApsaraDB for Redis instance, an account with the RoleRepl permission can run the SYNC and PSYNC commands. The RoleRepl permission can be granted to an account only in an ApsaraDB for Redis instance of the standard edition in Redis 4.0.
AccountDescription String No this is a test account

The description of the account.

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

The type of the account. Set this parameter to Normal.

Response parameters

Parameter Type Example Description
AcountName String demoaccount

The name of the account.

InstanceId String r-bp1xxxxxxxxxxxxx

The ID of the instance.

RequestId String ABAF95F6-35C1-4177-AF3A-70969EBDF624

The ID of the request.

Examples

Sample request


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

Sample success response

XML format

<CreateAccountResponse>
  <RequestId>ABAF95F6-35C1-4177-AF3A-70969EBDF624</RequestId>
  <AcountName>demoaccount</AcountName>
</CreateAccountResponse>

JSON format

{
	"RequestId":"ABAF95F6-35C1-4177-AF3A-70969EBDF624",
	"AcountName":"demoaccount"
}

Error codes

View error codes.