ALIYUN::POLARDB::Extensions is used to install database extensions (plugins).
Syntax
{
"Type": "ALIYUN::POLARDB::Extensions",
"Properties": {
"AccountName": String,
"DBClusterId": String,
"DBNames": List,
"Extensions": List,
"ResourceGroupId": String,
"SourceDBName": String,
"VpcId": String
}
}Properties
Property | Type | Required | Editable | Description | Constraints |
AccountName | String | Yes | No | The name of the account associated with the database. | None |
DBClusterId | String | Yes | No | The cluster ID. | None |
DBNames | List | Yes | No | The database names. | None |
Extensions | List | No | No | The extensions to install. | None |
ResourceGroupId | String | No | No | The resource group ID. | None |
SourceDBName | String | No | No | The source database name. | None |
VpcId | String | No | No | The VPC ID of the access endpoint. | None |
Return values
Fn::GetAtt
None
Examples
Scenario 1: Install extensions on a single database in an existing PolarDB cluster
ROSTemplateFormatVersion: '2015-09-01'
Description:
en: Install database extensions (such as PostGIS and pgvector) on a single database in an existing PolarDB cluster.
Parameters:
DBClusterId:
Type: String
Label: PolarDB Cluster ID
Description: The ID of the created PolarDB cluster.
DBName:
Type: String
Label: Database Name
Description: The name of the database on which extensions are to be installed.
Default: appdb
AccountName:
Type: String
Label: Database Account
Description: The name of the account associated with the database (must have database permissions).
Extensions:
Type: CommaDelimitedList
Label: Extensions
Description: A comma-separated list of database extension names to install, for example, postgis,pgvector.
Default: postgis,pgvector
Resources:
DbExtensions:
Type: ALIYUN::POLARDB::Extensions
Properties:
DBClusterId:
Ref: DBClusterId
DBNames:
- Ref: DBName
AccountName:
Ref: AccountName
Extensions:
Ref: Extensions
Outputs:
DBClusterId:
Description: The PolarDB cluster ID.
Value:
Ref: DBClusterId
DBName:
Description: The name of the database on which extensions are installed.
Value:
Ref: DBName
AccountName:
Description: The name of the account associated with the database.
Value:
Ref: AccountName
Extensions:
Description: The list of installed database extensions.
Value:
Fn::Join:
- ','
- Ref: Extensions{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"en": "Install database extensions (such as PostGIS and pgvector) on a single database in an existing PolarDB cluster."
},
"Parameters": {
"DBClusterId": {
"Type": "String",
"Label": "PolarDB Cluster ID",
"Description": "The ID of the created PolarDB cluster."
},
"DBName": {
"Type": "String",
"Label": "Database Name",
"Description": "The name of the database on which extensions are to be installed.",
"Default": "appdb"
},
"AccountName": {
"Type": "String",
"Label": "Database Account",
"Description": "The name of the account associated with the database (must have database permissions)."
},
"Extensions": {
"Type": "CommaDelimitedList",
"Label": "Extensions",
"Description": "A comma-separated list of database extension names to install, for example, postgis,pgvector.",
"Default": "postgis,pgvector"
}
},
"Resources": {
"DbExtensions": {
"Type": "ALIYUN::POLARDB::Extensions",
"Properties": {
"DBClusterId": { "Ref": "DBClusterId" },
"DBNames": [{ "Ref": "DBName" }],
"AccountName": { "Ref": "AccountName" },
"Extensions": { "Ref": "Extensions" }
}
}
},
"Outputs": {
"DBClusterId": {
"Description": "The PolarDB cluster ID.",
"Value": { "Ref": "DBClusterId" }
},
"DBName": {
"Description": "The name of the database on which extensions are installed.",
"Value": { "Ref": "DBName" }
},
"AccountName": {
"Description": "The name of the account associated with the database.",
"Value": { "Ref": "AccountName" }
},
"Extensions": {
"Description": "The list of installed database extensions.",
"Value": { "Fn::Join": [",", { "Ref": "Extensions" }] }
}
}
}Scenario 2: Batch install multiple extensions on multiple databases in an existing PolarDB cluster
ROSTemplateFormatVersion: '2015-09-01'
Description:
en: Batch install multiple database extensions on multiple databases in an existing PolarDB cluster.
Parameters:
DBClusterId:
Type: String
Label: PolarDB Cluster ID
Description: The ID of the created PolarDB cluster.
DBNames:
Type: CommaDelimitedList
Label: Database Name List
Description: A comma-separated list of database names on which extensions are to be installed, for example, appdb1,appdb2.
Default: appdb1,appdb2
AccountName:
Type: String
Label: Database Account
Description: The name of the account associated with the database (must have permissions on all listed databases).
Extensions:
Type: CommaDelimitedList
Label: Extensions
Description: A comma-separated list of database extension names to install, for example, postgis,pgvector.
Default: postgis,pgvector
Resources:
DbExtensions:
Type: ALIYUN::POLARDB::Extensions
Properties:
DBClusterId:
Ref: DBClusterId
DBNames:
Ref: DBNames
AccountName:
Ref: AccountName
Extensions:
Ref: Extensions
Outputs:
DBClusterId:
Description: The PolarDB cluster ID.
Value:
Ref: DBClusterId
AccountName:
Description: The name of the account associated with the database.
Value:
Ref: AccountName
DBNames:
Description: The list of database names on which extensions are installed.
Value:
Fn::Join:
- ','
- Ref: DBNames
Extensions:
Description: The list of installed database extensions.
Value:
Fn::Join:
- ','
- Ref: Extensions{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"en": "Batch install multiple database extensions on multiple databases in an existing PolarDB cluster."
},
"Parameters": {
"DBClusterId": {
"Type": "String",
"Label": "PolarDB Cluster ID",
"Description": "The ID of the created PolarDB cluster."
},
"DBNames": {
"Type": "CommaDelimitedList",
"Label": "Database Name List",
"Description": "A comma-separated list of database names on which extensions are to be installed, for example, appdb1,appdb2.",
"Default": "appdb1,appdb2"
},
"AccountName": {
"Type": "String",
"Label": "Database Account",
"Description": "The name of the account associated with the database (must have permissions on all listed databases)."
},
"Extensions": {
"Type": "CommaDelimitedList",
"Label": "Extensions",
"Description": "A comma-separated list of database extension names to install, for example, postgis,pgvector.",
"Default": "postgis,pgvector"
}
},
"Resources": {
"DbExtensions": {
"Type": "ALIYUN::POLARDB::Extensions",
"Properties": {
"DBClusterId": { "Ref": "DBClusterId" },
"DBNames": { "Ref": "DBNames" },
"AccountName": { "Ref": "AccountName" },
"Extensions": { "Ref": "Extensions" }
}
}
},
"Outputs": {
"DBClusterId": {
"Description": "The PolarDB cluster ID.",
"Value": { "Ref": "DBClusterId" }
},
"AccountName": {
"Description": "The name of the account associated with the database.",
"Value": { "Ref": "AccountName" }
},
"DBNames": {
"Description": "The list of database names on which extensions are installed.",
"Value": { "Fn::Join": [",", { "Ref": "DBNames" }] }
},
"Extensions": {
"Description": "The list of installed database extensions.",
"Value": { "Fn::Join": [",", { "Ref": "Extensions" }] }
}
}
}Scenario 3: Create a PolarDB PostgreSQL cluster, account, and database, then install extensions
ROSTemplateFormatVersion: '2015-09-01'
Description:
en: Create a PolarDB PostgreSQL cluster, a privileged account, and a database, and install database extensions (such as PostGIS and pgvector). Suitable for end-to-end extension database initialization scenarios.
Parameters:
ZoneId:
Type: String
Label: Availability Zone
Description: The availability zone to which the cluster and vSwitch belong.
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
DBNodeClass:
Type: String
Label: Node Specification
Description: The compute node specification for PolarDB-PG, for example, polar.pg.x4.medium or polar.pg.x4.large.
Default: polar.pg.x4.medium
DBVersion:
Type: String
Label: Database Engine Version
Description: The engine version of PolarDB-PG.
AllowedValues:
- '11'
- '14'
- '15'
Default: '14'
DBClusterDescription:
Type: String
Label: Cluster Description
Description: The description of the PolarDB cluster. The value must be 2 to 256 characters in length.
Default: PolarDB-PG extensions demo
SecurityIPList:
Type: String
Label: IP Whitelist
Description: The IP whitelist that is allowed to access the cluster. Separate multiple IP addresses with commas. For production environments, restrict to specific IP ranges.
Default: 0.0.0.0/0
AccountName:
Type: String
Label: Privileged Account Name
Description: The name of the privileged account for the cluster. It must start with a lowercase letter, contain only lowercase letters, digits, and underscores, be 1 to 16 characters in length, and cannot be a reserved word such as root or admin.
MinLength: 1
MaxLength: 16
Default: polardb_user
AccountPassword:
Type: String
Label: Privileged Account Password
Description: The password must be 8 to 32 characters in length and contain uppercase letters, lowercase letters, digits, and special characters.
NoEcho: true
MinLength: 8
MaxLength: 32
DBName:
Type: String
Label: Database Name
Description: The database name. It must start with a lowercase letter, contain only lowercase letters, digits, hyphens, and underscores, and be 1 to 64 characters in length.
Default: appdb
CharacterSetName:
Type: String
Label: Character Set
Description: The character set of the database.
Default: UTF8
Collate:
Type: String
Label: Collation
Description: The collation rule of the database (required for PostgreSQL). The value must be compatible with the character set.
Default: C
Ctype:
Type: String
Label: Character Classification
Description: The character classification of the database (required for PostgreSQL). The value must be consistent with the collation rule.
Default: C
Extensions:
Type: CommaDelimitedList
Label: Extensions
Description: A comma-separated list of database extension names to install, for example, postgis,pgvector.
Default: postgis,pgvector
Resources:
Vpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock: 192.168.0.0/16
VpcName: polardb-demo-vpc
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Ref: ZoneId
CidrBlock: 192.168.0.0/24
VpcId:
Ref: Vpc
VSwitchName: polardb-demo-vsw
DBCluster:
Type: ALIYUN::POLARDB::DBCluster
Properties:
DBType: PostgreSQL
DBVersion:
Ref: DBVersion
DBNodeClass:
Ref: DBNodeClass
PayType: PayAsYouGo
ZoneId:
Ref: ZoneId
VpcId:
Ref: Vpc
VSwitchId:
Ref: VSwitch
DBClusterDescription:
Ref: DBClusterDescription
StorageType: PSL5
SecurityIPList:
Ref: SecurityIPList
DbAccount:
Type: ALIYUN::POLARDB::Account
Properties:
DBClusterId:
Fn::GetAtt:
- DBCluster
- DBClusterId
AccountName:
Ref: AccountName
AccountPassword:
Ref: AccountPassword
AccountType: Super
AccountDescription: PolarDB privileged account for extensions
DependsOn: DBCluster
DbDatabase:
Type: ALIYUN::POLARDB::Database
Properties:
DBClusterId:
Fn::GetAtt:
- DBCluster
- DBClusterId
DBName:
Ref: DBName
CharacterSetName:
Ref: CharacterSetName
AccountName:
Ref: AccountName
AccountPrivilege: ReadWrite
Collate:
Ref: Collate
Ctype:
Ref: Ctype
DBDescription: Application database for extensions
DependsOn: DbAccount
DbExtensions:
Type: ALIYUN::POLARDB::Extensions
Properties:
DBClusterId:
Fn::GetAtt:
- DBCluster
- DBClusterId
DBNames:
- Ref: DBName
AccountName:
Ref: AccountName
Extensions:
Ref: Extensions
DependsOn:
- DbDatabase
- DbAccount
Outputs:
DBClusterId:
Description: The PolarDB cluster ID.
Value:
Fn::GetAtt:
- DBCluster
- DBClusterId
PrimaryConnectionString:
Description: The primary connection string of the PolarDB cluster.
Value:
Fn::GetAtt:
- DBCluster
- PrimaryConnectionString
AccountName:
Description: The name of the privileged account for the cluster.
Value:
Ref: AccountName
DBName:
Description: The name of the created database.
Value:
Ref: DBName
Extensions:
Description: The list of installed database extensions.
Value:
Fn::Join:
- ','
- Ref: Extensions{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"en": "Create a PolarDB PostgreSQL cluster, a privileged account, and a database, and install database extensions (such as PostGIS and pgvector). Suitable for end-to-end extension database initialization scenarios."
},
"Parameters": {
"ZoneId": {
"Type": "String",
"Label": "Availability Zone",
"Description": "The availability zone to which the cluster and vSwitch belong.",
"AssociationProperty": "ALIYUN::ECS::Instance::ZoneId"
},
"DBNodeClass": {
"Type": "String",
"Label": "Node Specification",
"Description": "The compute node specification for PolarDB-PG, for example, polar.pg.x4.medium or polar.pg.x4.large.",
"Default": "polar.pg.x4.medium"
},
"DBVersion": {
"Type": "String",
"Label": "Database Engine Version",
"Description": "The engine version of PolarDB-PG.",
"AllowedValues": ["11", "14", "15"],
"Default": "14"
},
"DBClusterDescription": {
"Type": "String",
"Label": "Cluster Description",
"Description": "The description of the PolarDB cluster. The value must be 2 to 256 characters in length.",
"Default": "PolarDB-PG extensions demo"
},
"SecurityIPList": {
"Type": "String",
"Label": "IP Whitelist",
"Description": "The IP whitelist that is allowed to access the cluster. Separate multiple IP addresses with commas. For production environments, restrict to specific IP ranges.",
"Default": "0.0.0.0/0"
},
"AccountName": {
"Type": "String",
"Label": "Privileged Account Name",
"Description": "The name of the privileged account for the cluster. It must start with a lowercase letter, contain only lowercase letters, digits, and underscores, be 1 to 16 characters in length, and cannot be a reserved word such as root or admin.",
"MinLength": 1,
"MaxLength": 16,
"Default": "polardb_user"
},
"AccountPassword": {
"Type": "String",
"Label": "Privileged Account Password",
"Description": "The password must be 8 to 32 characters in length and contain uppercase letters, lowercase letters, digits, and special characters.",
"NoEcho": true,
"MinLength": 8,
"MaxLength": 32
},
"DBName": {
"Type": "String",
"Label": "Database Name",
"Description": "The database name. It must start with a lowercase letter, contain only lowercase letters, digits, hyphens, and underscores, and be 1 to 64 characters in length.",
"Default": "appdb"
},
"CharacterSetName": {
"Type": "String",
"Label": "Character Set",
"Description": "The character set of the database.",
"Default": "UTF8"
},
"Collate": {
"Type": "String",
"Label": "Collation",
"Description": "The collation rule of the database (required for PostgreSQL). The value must be compatible with the character set.",
"Default": "C"
},
"Ctype": {
"Type": "String",
"Label": "Character Classification",
"Description": "The character classification of the database (required for PostgreSQL). The value must be consistent with the collation rule.",
"Default": "C"
},
"Extensions": {
"Type": "CommaDelimitedList",
"Label": "Extensions",
"Description": "A comma-separated list of database extension names to install, for example, postgis,pgvector.",
"Default": "postgis,pgvector"
}
},
"Resources": {
"Vpc": {
"Type": "ALIYUN::ECS::VPC",
"Properties": { "CidrBlock": "192.168.0.0/16", "VpcName": "polardb-demo-vpc" }
},
"VSwitch": {
"Type": "ALIYUN::ECS::VSwitch",
"Properties": {
"ZoneId": { "Ref": "ZoneId" },
"CidrBlock": "192.168.0.0/24",
"VpcId": { "Ref": "Vpc" },
"VSwitchName": "polardb-demo-vsw"
}
},
"DBCluster": {
"Type": "ALIYUN::POLARDB::DBCluster",
"Properties": {
"DBType": "PostgreSQL",
"DBVersion": { "Ref": "DBVersion" },
"DBNodeClass": { "Ref": "DBNodeClass" },
"PayType": "PayAsYouGo",
"ZoneId": { "Ref": "ZoneId" },
"VpcId": { "Ref": "Vpc" },
"VSwitchId": { "Ref": "VSwitch" },
"DBClusterDescription": { "Ref": "DBClusterDescription" },
"StorageType": "PSL5",
"SecurityIPList": { "Ref": "SecurityIPList" }
}
},
"DbAccount": {
"Type": "ALIYUN::POLARDB::Account",
"Properties": {
"DBClusterId": { "Fn::GetAtt": ["DBCluster", "DBClusterId"] },
"AccountName": { "Ref": "AccountName" },
"AccountPassword": { "Ref": "AccountPassword" },
"AccountType": "Super",
"AccountDescription": "PolarDB privileged account for extensions"
},
"DependsOn": "DBCluster"
},
"DbDatabase": {
"Type": "ALIYUN::POLARDB::Database",
"Properties": {
"DBClusterId": { "Fn::GetAtt": ["DBCluster", "DBClusterId"] },
"DBName": { "Ref": "DBName" },
"CharacterSetName": { "Ref": "CharacterSetName" },
"AccountName": { "Ref": "AccountName" },
"AccountPrivilege": "ReadWrite",
"Collate": { "Ref": "Collate" },
"Ctype": { "Ref": "Ctype" },
"DBDescription": "Application database for extensions"
},
"DependsOn": "DbAccount"
},
"DbExtensions": {
"Type": "ALIYUN::POLARDB::Extensions",
"Properties": {
"DBClusterId": { "Fn::GetAtt": ["DBCluster", "DBClusterId"] },
"DBNames": [{ "Ref": "DBName" }],
"AccountName": { "Ref": "AccountName" },
"Extensions": { "Ref": "Extensions" }
},
"DependsOn": ["DbDatabase", "DbAccount"]
}
},
"Outputs": {
"DBClusterId": {
"Description": "The PolarDB cluster ID.",
"Value": { "Fn::GetAtt": ["DBCluster", "DBClusterId"] }
},
"PrimaryConnectionString": {
"Description": "The primary connection string of the PolarDB cluster.",
"Value": { "Fn::GetAtt": ["DBCluster", "PrimaryConnectionString"] }
},
"AccountName": {
"Description": "The name of the privileged account for the cluster.",
"Value": { "Ref": "AccountName" }
},
"DBName": {
"Description": "The name of the created database.",
"Value": { "Ref": "DBName" }
},
"Extensions": {
"Description": "The list of installed database extensions.",
"Value": { "Fn::Join": [",", { "Ref": "Extensions" }] }
}
}
}