You can call GrantAccountPrivilege to modify the permission of an account of an ApsaraDB for Redis instance.

Note
  • The API supports only Apsaradb for Redis instances whose engine version is Redis 4.0 or above.
  • The ApsaraDB for Redis instance must be in the running status.

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 No GrantAccountPrivilege

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

InstanceId String Yes r-bp1xxxxxxxxxxxxx

The ID of the instance to which the account belongs.

AccountName String Yes demoaccount

The name of the database account.

  • Start with a lowercase English letter.
  • It can contain lowercase English letters, digits, and underscores (_).
  • It must start with a lowercase letter.
AccountPrivilege String Yes RoleReadWrite

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 architechture in Redis 4.0 or above.
RegionId String No cn-hangzhou

The ID of the region where the instance resides.

Response parameters

Parameter Type Example Description
RequestId String 3845BDF5-15A6-4444-B770-785018191E25

The ID of the request.

Examples

Sample request

https://r-kvstore.aliyuncs.com/
?Action=GrantAccountPrivilege
&InstanceId=r-bp1xxxxxxxxxxxxx
&AccountName=demoaccount
&AccountPrivilege=RoleReadOnly
&<Common request parameters>

Sample success responses

XML format

<GrantAccountPrivilegeResponse>
      <RequestId>3845BDF5-15A6-4444-B770-785018191E25</RequestId>
</GrantAccountPrivilegeResponse>

JSON format

{
    "RequestId": "3845BDF5-15A6-4444-B770-785018191E25"
}

Error codes.

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