ALIYUN::POLARDB::Database类型用于为PolarDB集群创建一个新的数据库。
语法
{
"Type": "ALIYUN::POLARDB::Database",
"Properties": {
"CharacterSetName": String,
"DBClusterId": String,
"DBName": String,
"AccountPrivilege": String,
"AccountName": String,
"Collate": String,
"Ctype": String,
"DBDescription": String
}
}
属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
CharacterSetName | String | 是 | 否 | 字符集。 | 关于字符集的取值范围,请参见字符集表。 |
DBClusterId | String | 是 | 否 | 集群ID。 | 无 |
DBName | String | 是 | 否 | 数据库名称。 | 名称需满足如下要求:
|
AccountPrivilege | String | 否 | 否 | 账号权限。 | 取值范围如下:
若该参数不填,则默认为ReadWrite。 说明
|
AccountName | String | 否 | 否 | 授权访问该数据库的账号名。 | 说明
|
Collate | String | 否 | 否 | 语言环境设置。 | 用于指定新建数据库的排序规则。 说明
|
Ctype | String | 否 | 否 | 语言环境设置。 | 用于指定数据库的字符分类。 说明
|
DBDescription | String | 否 | 是 | 数据库备注信息。 | 备注信息需满足如下要求:
说明 当集群为PolarDB PostgreSQL版(兼容Oracle)或PolarDB PostgreSQL版时,该参数必填;当集群为PolarDB MySQL版时,该参数非必填。 |
返回值
Fn::GetAtt
无
示例
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
CharacterSetName:
AssociationPropertyMetadata:
AutoChangeType: false
Type: String
Description:
en: The character set of the database. For more information, see Character sets.
AllowedValues:
- utf8
- geostd8
- gbk
- greek
- utf8mb4
- hebrew
- latin1
- hp8
- euckr
- keybcs2
- armscii8
- koi8r
- ascii
- koi8u
- big5
- latin2
- binary
- latin5
- cp1250
- latin7
- cp1251
- macce
- cp1256
- macroman
- cp1257
- sjis
- cp850
- swe7
- cp852
- tis620
- cp866
- ucs2
- cp932
- ujis
- dec8
- utf16
- eucjpms
- utf16le
- gb2312
Required: true
DBClusterId:
AssociationProperty: ALIYUN::POLARDB::DBCluster::DBClusterId
Type: String
Description:
en: The ID of the ApsaraDB for POLARDB cluster for which a database is to be created.
Required: true
DBName:
Type: String
Description:
en: |-
The name of the database to be created. The name must comply with the following rules:
It must start with a lowercase letter and consist of lowercase letters, digits, hyphens
(-), and underscores (_).
It must end with a letter or a digit. It can be up to 64 characters in length.
AllowedPattern: ^[a-z0-9][-_a-z0-9]{0,63}(?<![-_]$)$
Required: true
Resources:
Database:
Type: ALIYUN::POLARDB::Database
Properties:
CharacterSetName:
Ref: CharacterSetName
DBClusterId:
Ref: DBClusterId
DBName:
Ref: DBName
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"CharacterSetName": {
"AssociationPropertyMetadata": {
"AutoChangeType": false
},
"Type": "String",
"Description": {
"en": "The character set of the database. For more information, see Character sets."
},
"AllowedValues": [
"utf8",
"geostd8",
"gbk",
"greek",
"utf8mb4",
"hebrew",
"latin1",
"hp8",
"euckr",
"keybcs2",
"armscii8",
"koi8r",
"ascii",
"koi8u",
"big5",
"latin2",
"binary",
"latin5",
"cp1250",
"latin7",
"cp1251",
"macce",
"cp1256",
"macroman",
"cp1257",
"sjis",
"cp850",
"swe7",
"cp852",
"tis620",
"cp866",
"ucs2",
"cp932",
"ujis",
"dec8",
"utf16",
"eucjpms",
"utf16le",
"gb2312"
],
"Required": true
},
"DBClusterId": {
"AssociationProperty": "ALIYUN::POLARDB::DBCluster::DBClusterId",
"Type": "String",
"Description": {
"en": "The ID of the ApsaraDB for POLARDB cluster for which a database is to be created."
},
"Required": true
},
"DBName": {
"Type": "String",
"Description": {
"en": "The name of the database to be created. The name must comply with the following rules:\nIt must start with a lowercase letter and consist of lowercase letters, digits, hyphens\n(-), and underscores (_).\nIt must end with a letter or a digit. It can be up to 64 characters in length."
},
"AllowedPattern": "^[a-z0-9][-_a-z0-9]{0,63}(?<![-_]$)$",
"Required": true
},
},
"Resources": {
"Database": {
"Type": "ALIYUN::POLARDB::Database",
"Properties": {
"CharacterSetName": {
"Ref": "CharacterSetName"
},
"DBClusterId": {
"Ref": "DBClusterId"
},
"DBName": {
"Ref": "DBName"
}
}
}
}
}