OpenMCF logoOpenMCF

Loading...

AliCloud PolarDB Cluster

Deploys an Alibaba Cloud PolarDB cluster with bundled databases, accounts, and account privileges. Supports MySQL, PostgreSQL, and Oracle compatibility modes through a single component type.

What Gets Created

When you deploy an AliCloudPolardbCluster resource, OpenMCF provisions:

  • PolarDB Cluster -- an alicloud_polardb_cluster with the selected engine, node class, and node count
  • Databases -- one alicloud_polardb_database per entry in the databases list
  • Accounts -- one alicloud_polardb_account per entry in the accounts list
  • Account Privileges -- one alicloud_polardb_account_privilege per privilege entry, granting specific access levels on databases

Prerequisites

  • Alibaba Cloud credentials configured via environment variables or OpenMCF provider config
  • A VSwitch -- the PolarDB cluster is placed in a VSwitch (create one with AliCloudVswitch)
  • The VSwitch's VPC and availability zone determine the cluster's network placement

Quick Start

Create a file polardb-cluster.yaml:

apiVersion: ali-cloud.openmcf.org/v1
kind: AliCloudPolardbCluster
metadata:
  name: my-polardb
spec:
  region: cn-hangzhou
  dbType: MySQL
  dbVersion: "8.0"
  dbNodeClass: polar.mysql.x4.large
  vswitchId:
    valueFrom:
      name: my-db-vswitch
  databases:
    - dbName: myapp
  accounts:
    - accountName: app_user
      accountPassword: "${DB_PASSWORD}"
      privileges:
        - dbNames: [myapp]
          accountPrivilege: ReadWrite

Deploy:

openmcf apply -f polardb-cluster.yaml

This creates a MySQL 8.0 PolarDB cluster with 2 nodes (1 primary + 1 read replica), one database, one account, and ReadWrite access.

Configuration Reference

Required Fields

FieldTypeDescriptionValidation
regionstringAlibaba Cloud region (e.g., cn-hangzhou)Required; non-empty
dbTypestringDatabase engineRequired; one of: MySQL, PostgreSQL, Oracle
dbVersionstringEngine version (e.g., 8.0, 14, 11)Required; non-empty
dbNodeClassstringNode instance class (e.g., polar.mysql.x4.large)Required; non-empty
vswitchIdStringValueOrRefVSwitch ID. Can reference AliCloudVswitch via valueFrom.Required

Optional Fields

FieldTypeDefaultDescription
dbNodeCountint322Number of nodes (1 primary + N-1 read replicas); range 1-16
descriptionstringmetadata.nameCluster description (2-256 chars)
payTypestringPostPaidBilling: PostPaid or PrePaid
periodint32Subscription period in months (for PrePaid)
renewalStatusstringAuto-renewal: AutoRenewal, Normal, NotRenewal
autoRenewPeriodint32Auto-renewal period in months
zoneIdstringPrimary availability zone
securityIpslistIP whitelist for access control
securityGroupIdslistVPC security group IDs (max 3)
maintainTimestringMaintenance window (e.g., 02:00Z-03:00Z)
resourceGroupIdstringResource group for organizational grouping
tagsmapKey-value tags
creationCategorystringEdition: Normal, Basic, ArchiveNormal, NormalMultimaster, SENormal
subCategorystringSub-category: Exclusive, General (MySQL only)
storageTypestringStorage: PSL5, PSL4 (Enterprise), ESSDPL0-ESSDPL3, ESSDAUTOPL (Standard)
storageSpaceint32Storage in GB (20-100000; Standard Edition only)
tdeStatusstringTDE: Enabled or Disabled (irreversible once enabled)
encryptionKeystringKMS key ID for TDE
deletionLockint32Deletion protection: 1 (locked) or 0 (unlocked)
collectorStatusstringAudit log: Enable or Disabled
backupRetentionPolicyOnClusterDeletionstringBackup on delete: ALL, LATEST, NONE
parameterslistCluster parameter overrides
databaseslistDatabases to create (see below)
accountslistAccounts to create (see below)

Database Fields

FieldTypeDefaultDescription
dbNamestringDatabase name (required)
characterSetNamestringengine defaultCharacter set (e.g., utf8, utf8mb4, UTF8)
dbDescriptionstringDatabase description
collatestringCollation rules (PostgreSQL/Oracle only)
ctypestringCharacter type (PostgreSQL/Oracle only)

Account Fields

FieldTypeDefaultDescription
accountNamestringLogin name (required; 2-16 chars)
accountPasswordstringPassword (required; 8+ chars)
accountTypestringNormalNormal or Super
accountDescriptionstringAccount description
privilegeslistDatabase privileges (see below)

Privilege Fields

FieldTypeDefaultDescription
dbNameslistDatabases to grant access to (required; min 1)
accountPrivilegestringReadOnlyReadOnly, ReadWrite, DDLOnly, DMLOnly

Stack Outputs

After deployment, the following outputs are available in status.outputs:

OutputTypeDescription
cluster_idstringPolarDB cluster ID (e.g., pc-xxxxx)
connection_stringstringPrimary endpoint connection string
portstringDatabase service port
database_idsmapMap of database names to their IDs

Related Components

  • AliCloudVswitch -- VSwitch where the PolarDB cluster is placed
  • AliCloudVpc -- VPC that provides network isolation
  • AliCloudSecurityGroup -- Network security rules for cluster access
  • AliCloudKmsKey -- Customer-managed key for TDE encryption
  • AliCloudPrivateDnsZone -- Private DNS resolution for the cluster endpoint
  • AliCloudRdsInstance -- Alternative: traditional RDS for non-cloud-native workloads

Next article

AliCloud Private Zone

AliCloud Private Zone Provisions and manages an Alibaba Cloud Private Zone (PVTZ) for VPC-internal DNS resolution, with automated VPC attachment and inline DNS record management. Private Zone records are only resolvable within attached VPCs -- they are invisible to the public internet. What Gets Created When you deploy an AliCloudPrivateDnsZone resource, OpenMCF provisions: Private Zone -- an alicloudpvtzzone resource (Pulumi: pvtz.Zone) that creates the private DNS hosted zone VPC Attachment...
Read next article
Presets
3 ready-to-deploy configurationsView presets →