ALIYUN::REDIS::Account is used to create an account that has the specified permissions on an ApsaraDB for Redis instance.

Syntax

{
  "Type": "ALIYUN::REDIS::Account",
  "Properties": {
    "AccountDescription": String,
    "InstanceId": String,
    "AccountName": String,
    "AccountPrivilege": String,
    "AccountType": String,
    "AccountPassword": String
  }
}

Properties

PropertyTypeRequiredEditableDescriptionConstraint
AccountDescriptionStringNoYesThe description of the account. The description must be 2 to 256 characters in length, and start with a letter. It cannot start with http: // or https: //. The description can contain letters, digits, and hyphens (-).
InstanceIdStringYesNoThe ID of the instance. None
AccountNameStringYesNoThe name of the account. The name can be up to 16 characters in length. The name can contain lowercase letters, digits, and underscores (_). It must start with lowercase letters.
AccountPrivilegeStringNoYesThe permissions of the account. Default value: RoleReadWrite. Valid values:
  • RoleReadOnly: the read-only permission
  • RoleReadWrite: the read and write permission.
  • RoleRepl: the copy permission. In addition to reading data from and writing data to the ApsaraDB for Redis instance, an account that is granted 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.
AccountTypeStringNoNoThe type of the account. Set the value to Normal, which indicates the standard account.
AccountPasswordStringYesYesThe password of the account. The password must be 8 to 32 characters in length and must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Special characters include !@ # $ % ^ & * ( ) _ + - =.

Response parameters

Fn::GetAtt

  • InstanceId: the ID of the instance.
  • AccountName: the name of the account.

Examples

  • YAMLformat

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      InstanceId:
        Type: String
        Description: The ID of the instance for which you want to create the account.
    Resources:
      Account:
        Type: ALIYUN::REDIS::Account
        Properties:
          AccountDescription: Test Create Redis Account
          InstanceId:
            Ref: InstanceId
          AccountType: Normal
          AccountName: demo_redis
          AccountPrivilege: RoleReadWrite
          AccountPassword: Admin@123!
    Outputs:
      InstanceId:
        Description: The name of the instance.
        Value:
          Fn::GetAtt:
            - Account
            - InstanceId
      AccountName:
        Description: The name of the account.
        Value:
          Fn::GetAtt:
            - Account
            - AccountName
  • JSONformat

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "InstanceId": {
          "Type": "String",
          "Description": "The ID of the instance for which you want to create the account."
        }
      },
      "Resources": {
        "Account": {
          "Type": "ALIYUN::REDIS::Account",
          "Properties": {
            "AccountDescription": "Test Create Redis Account",
            "InstanceId": {
              "Ref": "InstanceId"
            },
            "AccountType": "Normal",
            "AccountName": "demo_redis",
            "AccountPrivilege": "RoleReadWrite",
            "AccountPassword": "Admin@123!"
          }
        }
      },
      "Outputs": {
        "InstanceId": {
          "Description": "The name of the instance.",
          "Value": {
            "Fn::GetAtt": [
              "Account",
              "InstanceId"
            ]
          }
        },
        "AccountName": {
          "Description": "The name of the account.",
          "Value": {
            "Fn::GetAtt": [
              "Account",
              "AccountName"
            ]
          }
        }
      }
    }

For more information, see Instance.json and Instance.yml. In the examples, the ALIYUN::REDIS::Account, ALIYUN::REDIS::Instance, and ALIYUN::REDIS::Whitelist resource types are involved.