ALIYUN::POLARDB::Account类型用于为POLARDB数据库创建账号。

语法

{
  "Type": "ALIYUN::POLARDB::Account",
  "Properties": {
    "DBClusterId": String,
    "AccountDescription": String,
    "AccountName": String,
    "AccountPrivilege": String,
    "DBName": String,
    "AccountType": String,
    "AccountPassword": String
  }
}

属性

属性名称 类型 必须 允许更新 描述 约束
DBClusterId String 集群ID。 无。
AccountDescription String 账号描述信息。 长度为2~256个字符。不能以http://或https://开头。
AccountName String 账号名。 长度不超过16个字符。由小写字母、数字、下划线组成,以小写字母开头。
AccountPrivilege String 账号权限。 取值:ReadWrite(读写)、ReadOnly(只读)、DMLOnly(只允许DML)、DDLOnly(只允许DDL)。默认值:ReadWrite。
DBName String 数据库名。 如果创建多个账户,需以英文逗号(,)分隔。
AccountType String 账号类型。 取值:Normal(普通账号)、Super(高权限账号)。默认值:Super。
AccountPassword String 密码。 长度为8~32个字符。由大写字母、小写字母、数字、特殊字符(!#$%^&*()_+-=)组成。

返回值

Fn::GetAtt

无。

示例

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Resources": {
    "Account": {
      "Type": "ALIYUN::POLARDB::Account",
      "Properties": {
        "DBClusterId": {
          "Ref": "DBClusterId"
        },
        "AccountDescription": {
          "Ref": "AccountDescription"
        },
        "AccountName": {
          "Ref": "AccountName"
        },
        "AccountPrivilege": {
          "Ref": "AccountPrivilege"
        },
        "AccountPassword": {
          "Ref": "AccountPassword"
        },
        "AccountType": {
          "Ref": "AccountType"
        },
        "DBName": {
          "Ref": "DBName"
        }
      }
    }
  },
  "Parameters": {
    "DBClusterId": {
      "Type": "String",
      "Description": "The ID of the ApsaraDB for POLARDB cluster for which a database account is to be created."
    },
    "AccountDescription": {
      "MinLength": 2,
      "Type": "String",
      "Description": {
        "The description of the database account. The description must comply with the following rules": [
          "It cannot start with http:// or https://.",
          "It must be 2 to 256 characters in length."
        ]
      },
      "MaxLength": 256
    },
    "AccountName": {
      "MinLength": 1,
      "Type": "String",
      "Description": {
        "The name of the database account. The name must comply with the following rules": [
          "It must start with a lowercase letter and consist of lowercase letters, digits, and underscores (_).",
          "It can be up to 16 characters in length."
        ]
      },
      "MaxLength": 16
    },
    "AccountPrivilege": {
      "Type": "String",
      "Description": "The permissions of the database account on the database. Valid values: ReadWrite: has read and write permissions on the database. ReadOnly: has the read-only permission on the database. DMLOnly: runs only data manipulation language (DML) statements. DDLOnly: runs only data definition language (DDL) statements. Default value: ReadWrite. Separate multiple permissions with a comma (,)."
    },
    "AccountPassword": {
      "MinLength": 8,
      "Type": "String",
      "Description": {
        "The password of the database account. The password must comply with the following rules": [
          "It must consist of uppercase letters, lowercase letters, digits, and special characters.",
          "Special characters include exclamation points (!), number signs (#), dollar signs ($), percent signs (%), carets (^), ampersands (&), asterisks (*), parentheses (()), underscores (_), plus signs (+), hyphens (-), and equal signs (=).",
          "It must be 8 to 32 characters in length."
        ]
      },
      "MaxLength": 32
    },
    "AccountType": {
      "Type": "String",
      "Description": "The type of the database account. Valid values: -Normal: standard account. -Super: privileged account. Default value: Super. Currently, POLARDB PostgreSQL and POLARDB compatible with Oracle do not support standard accounts. You can create only one privileged account for an ApsaraDB for POLARDB cluster.",
      "AllowedValues": [
        "Normal",
        "Super"
      ]
    },
    "DBName": {
      "Type": "String",
      "Description": "The name of the database whose access permissions are to be granted to the database account. Separate multiple databases with a comma (,)."
    }
  }
}

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Resources:
  Account:
    Type: ALIYUN::POLARDB::Account
    Properties:
      DBClusterId:
        Ref: DBClusterId
      AccountDescription:
        Ref: AccountDescription
      AccountName:
        Ref: AccountName
      AccountPrivilege:
        Ref: AccountPrivilege
      AccountPassword:
        Ref: AccountPassword
      AccountType:
        Ref: AccountType
      DBName:
        Ref: DBName
Parameters:
  DBClusterId:
    Type: String
    Description: The ID of the ApsaraDB for POLARDB cluster for which a database account
      is to be created.
  AccountDescription:
    MinLength: 2
    Type: String
    Description:
      The description of the database account. The description must comply with the following rules:
      - It cannot start with http:// or https://.
      - It must be 2 to 256 characters in length.
    MaxLength: 256
  AccountName:
    MinLength: 1
    Type: String
    Description:
      The name of the database account. The name must comply with the following rules:
      - It must start with a lowercase letter and consist of lowercase letters, digits,
        and underscores (_).
      - It can be up to 16 characters in length.
    MaxLength: 16
  AccountPrivilege:
    Type: String
    Description: 'The permissions of the database account on the database. Valid values: ReadWrite:
      has read and write permissions on the database. ReadOnly: has the read-only permission
      on the database. DMLOnly: runs only data manipulation language (DML) statements. DDLOnly:
      runs only data definition language (DDL) statements. Default value: ReadWrite. Separate
      multiple permissions with a comma (,).'
  AccountPassword:
    MinLength: 8
    Type: String
    Description:
      The password of the database account. The password must comply with the following rules:
      - It must consist of uppercase letters, lowercase letters, digits, and special
        characters.
      - Special characters include exclamation points (!), number signs (#), dollar
        signs ($), percent signs (%), carets (^), ampersands (&), asterisks (*), parentheses
        (()), underscores (_), plus signs (+), hyphens (-), and equal signs (=).
      - It must be 8 to 32 characters in length.
    MaxLength: 32
  AccountType:
    Type: String
    Description: 'The type of the database account. Valid values: -Normal: standard
      account. -Super: privileged account. Default value: Super. Currently, POLARDB
      for PostgreSQL and POLARDB compatible with Oracle do not support standard accounts.You
      can create only one privileged account for an ApsaraDB for POLARDB cluster.'
    AllowedValues:
    - Normal
    - Super
  DBName:
    Type: String
    Description: The name of the database whose access permissions are to be granted
      to the database account. Separate multiple databases with a comma (,).