ALIYUN::REDIS::Account类型用于在Tair(兼容 Redis)实例中创建有特定权限的账号。
语法
{
  "Type": "ALIYUN::REDIS::Account",
  "Properties": {
    "AccountDescription": String,
    "InstanceId": String,
    "AccountName": String,
    "AccountPrivilege": String,
    "AccountType": String,
    "AccountPassword": String
  }
}属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| AccountDescription | String | 否 | 是 | 账号描述。 | 长度为2~256个字符,以汉字和英文字母开头,不能以 | 
| InstanceId | String | 是 | 否 | 实例ID。 | 无 | 
| AccountName | String | 是 | 否 | 账号名称。 | 长度不超过16个字符,以小写英文字母开头。可包含小写英文字母、数字和下划线(_)。 | 
| AccountPrivilege | String | 否 | 是 | 账号权限。 | 取值: 
 | 
| AccountType | String | 否 | 否 | 账号类型。 | 取值:Normal(普通账号)。 | 
| AccountPassword | String | 是 | 是 | 账号密码。 | 长度为8~32个字符,必须包含大写英文字母、小写英文字母、特殊字符和数字中至少三种,支持的特殊字符为: | 
返回值
Fn::GetAtt
- InstanceId:实例ID。 
- AccountName:账号名称。 
示例
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{
  "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"
        ]
      }
    }
  }
}更多示例,请参见创建云数据库 Tair(兼容 Redis)实例、设置Tair(兼容 Redis)实例的IP白名单和创建有特定权限的账号的组合示例:YAML示例。
该文章对您有帮助吗?