ALIYUN::POLARDB::Account类型用于为PolarDB数据库创建账号。
语法
{
"Type": "ALIYUN::POLARDB::Account",
"Properties": {
"DBClusterId": String,
"AccountDescription": String,
"AccountName": String,
"AccountPrivilege": String,
"DBName": String,
"AccountType": String,
"PrivForAllDB": String,
"AccountPassword": String
}
}
属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
DBClusterId | String | 是 | 否 | 集群ID。 | 无 |
AccountDescription | String | 否 | 是 | 账号描述信息。 | 长度为2~256个字符。不能以 |
AccountName | String | 是 | 否 | 账号名。 | 长度不超过16个字符。以小写英文字母开头,可包含小写英文字母、数字和下划线(_)。 |
AccountPrivilege | String | 否 | 否 | 账号权限。 | 取值:
说明 本参数仅适用于PolarRDB MySQL集群普通账号。 |
DBName | String | 否 | 否 | 授权访问的数据库名称。 | 多个数据库名以英文逗号(,)分隔。 说明 本参数仅适用于PolarDB MySQL集群普通账号。 |
PrivForAllDB | String | 否 | 否 | 是否授权当前集群所有库及后续新增所有库的权限。 | 取值范围如下:
说明
|
AccountType | String | 否 | 否 | 账号类型。 | 取值:
|
AccountPassword | String | 是 | 是 | 密码。 | 长度为8~32个字符。可包含英文字母、数字和以下特殊字符:
|
返回值
Fn::GetAtt
无
示例
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
DBClusterId:
Type: String
Description: The ID of the ApsaraDB for POLARDB cluster for which a database account is to be created.
AccountName:
Type: String
Description: The name of the database account to be used.
Default: mytest
AccountPassword:
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.
MinLength: 8
MaxLength: 32
Resources:
Account:
Type: ALIYUN::POLARDB::Account
Properties:
DBClusterId:
Ref: DBClusterId
AccountName:
Ref: AccountName
AccountPrivilege: ReadOnly
AccountPassword:
Ref: AccountPassword
AccountType: Normal
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"DBClusterId": {
"Type": "String",
"Description": "The ID of the ApsaraDB for POLARDB cluster for which a database account is to be created."
},
"AccountName": {
"Type": "String",
"Description": "The name of the database account to be used.",
"Default": "mytest"
},
"AccountPassword": {
"Type": "String",
"Description": "The password of the database account. The password must comply with the following rules:\n- It must consist of uppercase letters, lowercase letters, digits, and special characters.\n- Special characters include exclamation points (!), number signs (#), dollar signs ($), percent signs (%), carets (^), ampersands (&), asterisks (*), parentheses (()), underscores (_), plus signs (+), hyphens (-), and equal signs (=).\n- It must be 8 to 32 characters in length.",
"MinLength": 8,
"MaxLength": 32
}
},
"Resources": {
"Account": {
"Type": "ALIYUN::POLARDB::Account",
"Properties": {
"DBClusterId": {
"Ref": "DBClusterId"
},
"AccountName": {
"Ref": "AccountName"
},
"AccountPrivilege": "ReadOnly",
"AccountPassword": {
"Ref": "AccountPassword"
},
"AccountType": "Normal"
}
}
}
}