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
無
樣本
情境 1 :為PolarDB資料庫建立唯讀普通帳號。
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.
AssociationProperty: ALIYUN::POLARDB::DBCluster::DBClusterId
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",
"AssociationProperty":"ALIYUN::POLARDB::DBCluster::DBClusterId",
"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"
}
}
}
}情境 2 :為PolarDB資料庫建立高許可權帳號。
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.
AssociationProperty: ALIYUN::POLARDB::DBCluster::DBClusterId
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: ReadWrite
AccountPassword:
Ref: AccountPassword
AccountType: Super{
"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.",
"AssociationProperty": "ALIYUN::POLARDB::DBCluster::DBClusterId"
},
"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": "ReadWrite",
"AccountPassword": {
"Ref": "AccountPassword"
},
"AccountType": "Super"
}
}
}
}情境 3 :原生 SQL 輕鬆實現多模態智能檢索。
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 原生 SQL 輕鬆實現多模態智能檢索。
en: Native SQL easily realizes multimodal intelligent retrieval.
Parameters:
CommonName:
Type: String
Default: SmartSearch
BucketName:
AssociationProperty: AutoCompleteInput
AssociationPropertyMetadata:
Length: 6
Prefix: test-bucket-
CharacterClasses:
- Class: lowercase
min: 1
Type: String
Label:
zh-cn: Bucket名稱
en: Bucket Name
ZoneId:
Type: String
Label:
zh-cn: 可用性區域ID
en: Available Zone ID
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
AccountName:
Type: String
Label:
zh-cn: 資料庫使用者名稱
en: Account Name
Description:
zh-cn: 長度不超過16個字元。以小寫英文字母開頭,可包含小寫英文字母、數字和底線(_)。
en: The length should not exceed 16 characters. It begins with a lowercase English letter and can contain lowercase English letters, numbers and underscores (_).
ConstraintDescription:
zh-cn: 長度不超過16個字元。以小寫英文字母開頭,可包含小寫英文字母、數字和底線(_)。
en: The length should not exceed 16 characters. It begins with a lowercase English letter and can contain lowercase English letters, numbers and underscores (_).
AllowedPattern: '^[a-z][a-z0-9_]{0,30}[a-z0-9]$'
Default: polar_ai
MaxLength: 16
MinLength: 2
AccountPassword:
Type: String
Description:
en: Server login password, Length 8-32, must contain three(Capital letters, lowercase letters, numbers, !@#$%^&*()_+-= Special symbol in)
zh-cn: 資料庫訪問密碼,長度8-32,必須包含三項(大寫字母、小寫字母、數字、 !@#$%^&*()_+-= 中的特殊符號)
Label:
en: Account Password
zh-cn: 資料庫密碼
ConstraintDescription:
en: Length 8-32, must contain three(Capital letters, lowercase letters, numbers, !@#$%^&*()_+-=Special symbol in)
zh-cn: 長度8-32,必須包含三項(大寫字母、小寫字母、數字、 !@#$%^&*()_+-=中的特殊符號)
AllowedPattern: '^[0-9A-Za-z_!@#$%^&*()_+\-=\+]+$'
MinLength: 8
MaxLength: 32
NoEcho: true
DBName:
Type: String
Label:
en: Database Name
zh-cn: 資料庫名稱
AllowedPattern: ^[a-z][a-z0-9_-]{0,62}[a-z0-9]$
Description:
en: It is composed of lowercase letters, numbers, an underscore (-), and an underscore (_), ending with a lowercase letter or number, beginning with a letter, and ending with a letter or number, with a maximum of 64 characters.
zh-cn: 由小寫字母、數字、中劃線(-)、底線(_)組成,小寫字母或數字結尾,以字母開頭,以字母或數字結尾,最長 64 個字元。
ConstraintDescription:
en: It is composed of lowercase letters, numbers, an underscore (-), and an underscore (_), ending with a lowercase letter or number, beginning with a letter, and ending with a letter or number, with a maximum of 64 characters.
zh-cn: 由小寫字母、數字、中劃線(-)、底線(_)組成,小寫字母或數字結尾,以字母開頭,以字母或數字結尾,最長 64 個字元。
Default: db-test
PolarDBNodeClass:
Type: String
Label:
en: PolarDB Node Specifications
zh-cn: 規格和代理
AssociationProperty: ALIYUN::POLARDB::DBCluster::DBNodeClass
AssociationPropertyMetadata:
ZoneId: ${ZoneId}
DBVersion: "14"
DBType: PostgreSQL
PayType: Postpaid
CommodityCode: polardb_payg
Default: polar.pg.g2.2xlarge.c
Resources:
VPC:
Type: ALIYUN::ECS::VPC
Properties:
VpcName:
Fn::Sub: VPC_${CommonName}
CidrBlock: 192.168.0.0/16
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
VpcId:
Ref: VPC
CidrBlock: 192.168.1.0/24
ZoneId:
Ref: ZoneId
VSwitchName:
Fn::Sub: vsw_001_${CommonName}
PolardbCluster:
Type: ALIYUN::POLARDB::DBCluster
Properties:
VpcId:
Ref: VPC
SecurityIPList: 0.0.0.0/0
DBType: PostgreSQL
ClusterNetworkType: VPC
ZoneId:
Ref: ZoneId
VSwitchId:
Ref: VSwitch
DBVersion: "14"
CreationCategory: SENormal
StorageSpace: 20
HotStandbyCluster: 'OFF'
DBNodeClass:
Ref: PolarDBNodeClass
PayType: Postpaid
DBNodeNum: 2
StorageType: ESSDPL1
Account:
Type: ALIYUN::POLARDB::Account
Properties:
DBClusterId:
Ref: PolardbCluster
AccountName:
Ref: AccountName
AccountPassword:
Ref: AccountPassword
AccountType: Super
Database:
DependsOn: Account
Type: ALIYUN::POLARDB::Database
Properties:
CharacterSetName: utf8
AccountPrivilege: ReadWrite
AccountName:
Ref: AccountName
DBClusterId:
Ref: PolardbCluster
DBName:
Ref: DBName
Collate: C
Ctype: C
DBClusterEndpointAddress:
Type: ALIYUN::POLARDB::DBClusterEndpointAddress
DependsOn: Account
Properties:
DBClusterId:
Ref: PolardbCluster
DBEndpointId:
Fn::GetAtt:
- PolardbCluster
- ClusterEndpointId
OSSBucket:
Type: ALIYUN::OSS::Bucket
Properties:
BucketName:
Ref: BucketName
DeletionForce: true
RedundancyType: ZRS
Outputs:
BucketName:
Description:
en: OSS Bucket Name.
zh-cn: Object Storage Service儲存桶名。
Value:
Ref: BucketName
AccountName:
Description:
en: PolarDB account name.
zh-cn: PolarDB 資料庫使用者名稱。
Value:
Ref: AccountName
AccountPassword:
NoEcho: true
Description:
en: PolarDB account password.
zh-cn: PolarDB 資料庫密碼。
Value:
Ref: AccountPassword
DBName:
Description:
en: PolarDB database name.
zh-cn: PolarDB 資料庫名稱。
Value:
Ref: DBName
ConnectionString:
Description:
en: PolarDB database connection string.
zh-cn: PolarDB 資料庫的公網地址。
Value:
Fn::Sub: ${DBClusterEndpointAddress.ConnectionString}:5432
Metadata:
ALIYUN::ROS::Interface:
Outputs:
- BucketName
- AccountName
- AccountPassword
- DBName
- ConnectionString
ParameterGroups:
- Parameters:
- ZoneId
Label:
default:
en: Network Configuration
zh-cn: 網路基礎配置
- Parameters:
- BucketName
Label:
default:
en: OSS Configuration
zh-cn: OSS 礎配置
- Parameters:
- PolarDBNodeClass
- DBName
- AccountName
- AccountPassword
Label:
default:
en: PolarDB PostgreSQL Configuration
zh-cn: 雲資料庫 PolarDB PostgreSQL 配置
TemplateTags:
- acs:technical-solution:internet-application-development:原生 SQL 輕鬆實現多模態智能檢索-tech_solu_262
Hidden:
- CommonName{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "原生 SQL 輕鬆實現多模態智能檢索。",
"en": "Native SQL easily realizes multimodal intelligent retrieval."
},
"Parameters": {
"CommonName": {
"Type": "String",
"Default": "SmartSearch"
},
"BucketName": {
"AssociationProperty": "AutoCompleteInput",
"AssociationPropertyMetadata": {
"Length": 6,
"Prefix": "test-bucket-",
"CharacterClasses": [
{
"Class": "lowercase",
"min": 1
}
]
},
"Type": "String",
"Label": {
"zh-cn": "Bucket名稱",
"en": "Bucket Name"
}
},
"ZoneId": {
"Type": "String",
"Label": {
"zh-cn": "可用性區域ID",
"en": "Available Zone ID"
},
"AssociationProperty": "ALIYUN::ECS::Instance::ZoneId"
},
"AccountName": {
"Type": "String",
"Label": {
"zh-cn": "資料庫使用者名稱",
"en": "Account Name"
},
"Description": {
"zh-cn": "長度不超過16個字元。以小寫英文字母開頭,可包含小寫英文字母、數字和底線(_)。",
"en": "The length should not exceed 16 characters. It begins with a lowercase English letter and can contain lowercase English letters, numbers and underscores (_)."
},
"ConstraintDescription": {
"zh-cn": "長度不超過16個字元。以小寫英文字母開頭,可包含小寫英文字母、數字和底線(_)。",
"en": "The length should not exceed 16 characters. It begins with a lowercase English letter and can contain lowercase English letters, numbers and underscores (_)."
},
"AllowedPattern": "^[a-z][a-z0-9_]{0,30}[a-z0-9]$",
"Default": "polar_ai",
"MaxLength": 16,
"MinLength": 2
},
"AccountPassword": {
"Type": "String",
"Description": {
"en": "Server login password, Length 8-32, must contain three(Capital letters, lowercase letters, numbers, !@#$%^&*()_+-= Special symbol in)",
"zh-cn": "資料庫訪問密碼,長度8-32,必須包含三項(大寫字母、小寫字母、數字、 !@#$%^&*()_+-= 中的特殊符號)"
},
"Label": {
"en": "Account Password",
"zh-cn": "資料庫密碼"
},
"ConstraintDescription": {
"en": "Length 8-32, must contain three(Capital letters, lowercase letters, numbers, !@#$%^&*()_+-=Special symbol in)",
"zh-cn": "長度8-32,必須包含三項(大寫字母、小寫字母、數字、 !@#$%^&*()_+-=中的特殊符號)"
},
"AllowedPattern": "^[0-9A-Za-z_!@#$%^&*()_+\\-=\\+]+$",
"MinLength": 8,
"MaxLength": 32,
"NoEcho": true
},
"DBName": {
"Type": "String",
"Label": {
"en": "Database Name",
"zh-cn": "資料庫名稱"
},
"AllowedPattern": "^[a-z][a-z0-9_-]{0,62}[a-z0-9]$",
"Description": {
"en": "It is composed of lowercase letters, numbers, an underscore (-), and an underscore (_), ending with a lowercase letter or number, beginning with a letter, and ending with a letter or number, with a maximum of 64 characters.",
"zh-cn": "由小寫字母、數字、中劃線(-)、底線(_)組成,小寫字母或數字結尾,以字母開頭,以字母或數字結尾,最長 64 個字元。"
},
"ConstraintDescription": {
"en": "It is composed of lowercase letters, numbers, an underscore (-), and an underscore (_), ending with a lowercase letter or number, beginning with a letter, and ending with a letter or number, with a maximum of 64 characters.",
"zh-cn": "由小寫字母、數字、中劃線(-)、底線(_)組成,小寫字母或數字結尾,以字母開頭,以字母或數字結尾,最長 64 個字元。"
},
"Default": "db-test"
},
"PolarDBNodeClass": {
"Type": "String",
"Label": {
"en": "PolarDB Node Specifications",
"zh-cn": "規格和代理"
},
"AssociationProperty": "ALIYUN::POLARDB::DBCluster::DBNodeClass",
"AssociationPropertyMetadata": {
"ZoneId": "${ZoneId}",
"DBVersion": "14",
"DBType": "PostgreSQL",
"PayType": "Postpaid",
"CommodityCode": "polardb_payg"
},
"Default": "polar.pg.g2.2xlarge.c"
}
},
"Resources": {
"VPC": {
"Type": "ALIYUN::ECS::VPC",
"Properties": {
"VpcName": {
"Fn::Sub": "VPC_${CommonName}"
},
"CidrBlock": "192.168.0.0/16"
}
},
"VSwitch": {
"Type": "ALIYUN::ECS::VSwitch",
"Properties": {
"VpcId": {
"Ref": "VPC"
},
"CidrBlock": "192.168.1.0/24",
"ZoneId": {
"Ref": "ZoneId"
},
"VSwitchName": {
"Fn::Sub": "vsw_001_${CommonName}"
}
}
},
"PolardbCluster": {
"Type": "ALIYUN::POLARDB::DBCluster",
"Properties": {
"VpcId": {
"Ref": "VPC"
},
"SecurityIPList": "0.0.0.0/0",
"DBType": "PostgreSQL",
"ClusterNetworkType": "VPC",
"ZoneId": {
"Ref": "ZoneId"
},
"VSwitchId": {
"Ref": "VSwitch"
},
"DBVersion": "14",
"CreationCategory": "SENormal",
"StorageSpace": 20,
"HotStandbyCluster": "OFF",
"DBNodeClass": {
"Ref": "PolarDBNodeClass"
},
"PayType": "Postpaid",
"DBNodeNum": 2,
"StorageType": "ESSDPL1"
}
},
"Account": {
"Type": "ALIYUN::POLARDB::Account",
"Properties": {
"DBClusterId": {
"Ref": "PolardbCluster"
},
"AccountName": {
"Ref": "AccountName"
},
"AccountPassword": {
"Ref": "AccountPassword"
},
"AccountType": "Super"
}
},
"Database": {
"DependsOn": "Account",
"Type": "ALIYUN::POLARDB::Database",
"Properties": {
"CharacterSetName": "utf8",
"AccountPrivilege": "ReadWrite",
"AccountName": {
"Ref": "AccountName"
},
"DBClusterId": {
"Ref": "PolardbCluster"
},
"DBName": {
"Ref": "DBName"
},
"Collate": "C",
"Ctype": "C"
}
},
"DBClusterEndpointAddress": {
"Type": "ALIYUN::POLARDB::DBClusterEndpointAddress",
"DependsOn": "Account",
"Properties": {
"DBClusterId": {
"Ref": "PolardbCluster"
},
"DBEndpointId": {
"Fn::GetAtt": [
"PolardbCluster",
"ClusterEndpointId"
]
}
}
},
"OSSBucket": {
"Type": "ALIYUN::OSS::Bucket",
"Properties": {
"BucketName": {
"Ref": "BucketName"
},
"DeletionForce": true,
"RedundancyType": "ZRS"
}
}
},
"Outputs": {
"BucketName": {
"Description": {
"en": "OSS Bucket Name.",
"zh-cn": "Object Storage Service儲存桶名。"
},
"Value": {
"Ref": "BucketName"
}
},
"AccountName": {
"Description": {
"en": "PolarDB account name.",
"zh-cn": "PolarDB 資料庫使用者名稱。"
},
"Value": {
"Ref": "AccountName"
}
},
"AccountPassword": {
"NoEcho": true,
"Description": {
"en": "PolarDB account password.",
"zh-cn": "PolarDB 資料庫密碼。"
},
"Value": {
"Ref": "AccountPassword"
}
},
"DBName": {
"Description": {
"en": "PolarDB database name.",
"zh-cn": "PolarDB 資料庫名稱。"
},
"Value": {
"Ref": "DBName"
}
},
"ConnectionString": {
"Description": {
"en": "PolarDB database connection string.",
"zh-cn": "PolarDB 資料庫的公網地址。"
},
"Value": {
"Fn::Sub": "${DBClusterEndpointAddress.ConnectionString}:5432"
}
}
},
"Metadata": {
"ALIYUN::ROS::Interface": {
"Outputs": [
"BucketName",
"AccountName",
"AccountPassword",
"DBName",
"ConnectionString"
],
"ParameterGroups": [
{
"Parameters": [
"ZoneId"
],
"Label": {
"default": {
"en": "Network Configuration",
"zh-cn": "網路基礎配置"
}
}
},
{
"Parameters": [
"BucketName"
],
"Label": {
"default": {
"en": "OSS Configuration",
"zh-cn": "OSS 礎配置"
}
}
},
{
"Parameters": [
"PolarDBNodeClass",
"DBName",
"AccountName",
"AccountPassword"
],
"Label": {
"default": {
"en": "PolarDB PostgreSQL Configuration",
"zh-cn": "雲資料庫 PolarDB PostgreSQL 配置"
}
}
}
],
"TemplateTags": [
"acs:technical-solution:internet-application-development:原生 SQL 輕鬆實現多模態智能檢索-tech_solu_262"
],
"Hidden": [
"CommonName"
]
}
}
}更多樣本,請參考包含此資源的公用模板。