全部产品
Search
文档中心

Resource Orchestration Service:ALIYUN::POLARDB::Account

更新时间:Feb 07, 2026

Tipe resource ALIYUN::POLARDB::Account digunakan untuk membuat akun pada database PolarDB.

Sintaksis

{
  "Type": "ALIYUN::POLARDB::Account",
  "Properties": {
    "DBClusterId": String,
    "AccountDescription": String,
    "AccountName": String,
    "AccountPrivilege": String,
    "DBName": String,
    "AccountType": String,
    "PrivForAllDB": String,
    "AccountPassword": String
  }
}

Properti

Nama properti

Tipe

Wajib

Dapat diperbarui

Deskripsi

Batasan

DBClusterId

String

Ya

Tidak

ID kluster.

Tidak ada

AccountDescription

String

Tidak

Ya

Deskripsi akun.

Panjangnya 2 hingga 256 karakter. Tidak boleh diawali denganhttp:// atauhttps://.

AccountName

String

Ya

Tidak

Nama akun.

Panjang tidak boleh melebihi 16 karakter. Diawali dengan huruf kecil bahasa Inggris. Dapat berisi huruf kecil bahasa Inggris, angka, dan garis bawah (_).

AccountPrivilege

String

Tidak

Tidak

Hak istimewa akun.

Nilai:

  • ReadWrite (default): Baca dan tulis.

  • ReadOnly: Read-only.

  • DMLOnly: DML only.

  • DDLOnly: DDL only.

Catatan

Parameter ini hanya berlaku untuk akun standar pada kluster PolarDB for MySQL.

DBName

String

Tidak

Tidak

Nama database yang akan diberikan akses.

Pisahkan beberapa nama database dengan koma (,).

Catatan

Parameter ini hanya berlaku untuk akun standar pada kluster PolarDB for MySQL.

PrivForAllDB

String

Tidak

Tidak

Berikan izin untuk semua database yang sudah ada dan semua database yang baru ditambahkan di kluster saat ini.

Nilai:

  • 0 atau kosong: Jangan berikan.

  • 1: Grant.

Catatan
  • Parameter AccountPrivilege harus disediakan agar berlaku.

  • Ketika parameter diatur ke 1, AccountPrivilege diberikan ke semua database.

AccountType

String

Tidak

Tidak

Jenis akun.

Nilai:

  • Normal: Akun standar.

  • Super (default): Akun istimewa.

AccountPassword

String

Ya

Ya

Password.

Panjangnya 8 hingga 32 karakter. Dapat berisi huruf bahasa Inggris, angka, dan karakter khusus berikut:

!#$%^&*()_+-=

Nilai kembalian

Fn::GetAtt

Tidak ada

Contoh

Skenario 1: Buat akun standar read-only untuk database PolarDB.

Buat cepat

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  DBClusterId:
    Type: String
    Description: ID kluster ApsaraDB for POLARDB tempat akun database akan dibuat.
    AssociationProperty: ALIYUN::POLARDB::DBCluster::DBClusterId
  AccountName:
    Type: String
    Description: Nama akun database yang akan digunakan.
    Default: mytest
  AccountPassword:
    Type: String
    Description: |-
      Password akun database. Password harus memenuhi aturan berikut:
      - Harus terdiri dari huruf kapital, huruf kecil, angka, dan karakter khusus.
      - Karakter khusus meliputi tanda seru (!), tanda pagar (#), tanda dolar ($), tanda persen (%), tanda sisipan (^), tanda ampersand (&), tanda bintang (*), tanda kurung (()), garis bawah (_), tanda plus (+), tanda hubung (-), dan tanda sama dengan (=).
      - Panjangnya harus 8 hingga 32 karakter.
    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": "ID kluster ApsaraDB for POLARDB tempat akun database akan dibuat."
    },
    "AccountName": {
      "Type": "String",
      "Description": "Nama akun database yang akan digunakan.",
      "Default": "mytest"
    },
    "AccountPassword": {
      "Type": "String",
      "Description": "Password akun database. Password harus memenuhi aturan berikut:\n- Harus terdiri dari huruf kapital, huruf kecil, angka, dan karakter khusus.\n- Karakter khusus meliputi tanda seru (!), tanda pagar (#), tanda dolar ($), tanda persen (%), tanda sisipan (^), tanda ampersand (&), tanda bintang (*), tanda kurung (()), garis bawah (_), tanda plus (+), tanda hubung (-), dan tanda sama dengan (=).\n- Panjangnya harus 8 hingga 32 karakter.",
      "MinLength": 8,
      "MaxLength": 32
    }
  },
  "Resources": {
    "Account": {
      "Type": "ALIYUN::POLARDB::Account",
      "Properties": {
        "DBClusterId": {
          "Ref": "DBClusterId"
        },
        "AccountName": {
          "Ref": "AccountName"
        },
        "AccountPrivilege": "ReadOnly",
        "AccountPassword": {
          "Ref": "AccountPassword"
        },
        "AccountType": "Normal"
      }
    }
  }
}

Skenario 2: Buat akun istimewa untuk database PolarDB.

Buat cepat

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  DBClusterId:
    Type: String
    Description: ID kluster ApsaraDB for POLARDB tempat akun database akan dibuat.
    AssociationProperty: ALIYUN::POLARDB::DBCluster::DBClusterId
  AccountName:
    Type: String
    Description: Nama akun database yang akan digunakan.
    Default: mytest
  AccountPassword:
    Type: String
    Description: |-
      Password akun database. Password harus memenuhi aturan berikut:
      - Harus terdiri dari huruf kapital, huruf kecil, angka, dan karakter khusus.
      - Karakter khusus meliputi tanda seru (!), tanda pagar (#), tanda dolar ($), tanda persen (%), tanda sisipan (^), tanda ampersand (&), tanda bintang (*), tanda kurung (()), garis bawah (_), tanda plus (+), tanda hubung (-), dan tanda sama dengan (=).
      - Panjangnya harus 8 hingga 32 karakter.
    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": "ID kluster ApsaraDB for POLARDB tempat akun database akan dibuat.",
      "AssociationProperty": "ALIYUN::POLARDB::DBCluster::DBClusterId"
    },
    "AccountName": {
      "Type": "String",
      "Description": "Nama akun database yang akan digunakan.",
      "Default": "mytest"
    },
    "AccountPassword": {
      "Type": "String",
      "Description": "Password akun database. Password harus memenuhi aturan berikut:\n- Harus terdiri dari huruf kapital, huruf kecil, angka, dan karakter khusus.\n- Karakter khusus meliputi tanda seru (!), tanda pagar (#), tanda dolar ($), tanda persen (%), tanda sisipan (^), tanda ampersand (&), tanda bintang (*), tanda kurung (()), garis bawah (_), tanda plus (+), tanda hubung (-), dan tanda sama dengan (=).\n- Panjangnya harus 8 hingga 32 karakter.",
      "MinLength": 8,
      "MaxLength": 32
    }
  },
  "Resources": {
    "Account": {
      "Type": "ALIYUN::POLARDB::Account",
      "Properties": {
        "DBClusterId": {
          "Ref": "DBClusterId"
        },
        "AccountName": {
          "Ref": "AccountName"
        },
        "AccountPrivilege": "ReadWrite",
        "AccountPassword": {
          "Ref": "AccountPassword"
        },
        "AccountType": "Super"
      }
    }
  }
}

Skenario 3: Implementasikan pengambilan cerdas multimodal secara mudah menggunakan SQL native.

Buat cepat

ROSTemplateFormatVersion: '2015-09-01'
Description: Lakukan pengambilan cerdas multimodal secara mudah dengan SQL native.
Parameters:
  CommonName:
    Type: String
    Default: SmartSearch
  BucketName:
    AssociationProperty: AutoCompleteInput
    AssociationPropertyMetadata:
      Length: 6
      Prefix: test-bucket-
      CharacterClasses:
        - Class: lowercase
          min: 1
    Type: String
    Label: Bucket Name
  ZoneId:
    Type: String
    Label: Zone ID
    AssociationProperty: ALIYUN::ECS::Instance::ZoneId
  AccountName:
    Type: String
    Label: Database username
    Description: Panjangnya harus 2 hingga 16 karakter. Harus diawali dengan huruf kecil dan hanya boleh berisi huruf kecil, angka, dan garis bawah (_).
    ConstraintDescription: Panjangnya harus 2 hingga 16 karakter. Harus diawali dengan huruf kecil dan hanya boleh berisi huruf kecil, angka, dan garis bawah (_).
    AllowedPattern: '^[a-z][a-z0-9_]{0,30}[a-z0-9]$'
    Default: polar_ai
    MaxLength: 16
    MinLength: 2
  AccountPassword:
    Type: String
    Description: Password akses database. Panjangnya harus 8 hingga 32 karakter dan harus mengandung minimal tiga dari jenis karakter berikut: huruf kapital, huruf kecil, angka, dan karakter khusus (!@#$%^&*()_+-=).
    Label: Database password
    ConstraintDescription: Password akses database. Panjangnya harus 8 hingga 32 karakter dan harus mengandung minimal tiga dari jenis karakter berikut: huruf kapital, huruf kecil, angka, dan karakter khusus (!@#$%^&*()_+-=).
    AllowedPattern: '^[0-9A-Za-z_!@#$%^&*()_+\-=\+]+$'
    MinLength: 8
    MaxLength: 32
    NoEcho: true
  DBName:
    Type: String
    Label: Database Name
    AllowedPattern: ^[a-z][a-z0-9_-]{0,62}[a-z0-9]$
    Description: Panjang maksimal 64 karakter. Harus diawali dengan huruf dan diakhiri dengan huruf atau angka. Dapat berisi huruf kecil, angka, tanda hubung (-), dan garis bawah (_).
    ConstraintDescription: Panjang maksimal 64 karakter. Harus diawali dengan huruf dan diakhiri dengan huruf atau angka. Dapat berisi huruf kecil, angka, tanda hubung (-), dan garis bawah (_).
    Default: db-test
  PolarDBNodeClass:
    Type: String
    Label: PolarDB Node Specifications
    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: Nama bucket Object Storage Service (OSS).
    Value:
      Ref: BucketName
  AccountName:
    Description: Username untuk database PolarDB.
    Value:
      Ref: AccountName
  AccountPassword:
    NoEcho: true
    Description: Password untuk database PolarDB.
    Value:
      Ref: AccountPassword
  DBName:
    Description: Nama database PolarDB.
    Value:
      Ref: DBName
  ConnectionString:
    Description: Titik akhir publik database PolarDB.
    Value:
      Fn::Sub: ${DBClusterEndpointAddress.ConnectionString}:5432
Metadata:
  ALIYUN::ROS::Interface:
    Outputs:
      - BucketName
      - AccountName
      - AccountPassword
      - DBName
      - ConnectionString
    ParameterGroups:
      - Parameters:
          - ZoneId
        Label:
          default: Basic network configuration
      - Parameters:
          - BucketName
        Label:
          default: Basic OSS configuration
      - Parameters:
          - PolarDBNodeClass
          - DBName
          - AccountName
          - AccountPassword
        Label:
          default: ApsaraDB PolarDB for PostgreSQL configuration
    TemplateTags:
      - acs:technical-solution:internet-application-development:Easily perform multimodal intelligent retrieval with native SQL-tech_solu_262
    Hidden:
      - CommonName
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "Lakukan pengambilan cerdas multimodal secara mudah dengan SQL native.",
  "Parameters": {
    "CommonName": {
      "Type": "String",
      "Default": "SmartSearch"
    },
    "BucketName": {
      "AssociationProperty": "AutoCompleteInput",
      "AssociationPropertyMetadata": {
        "Length": 6,
        "Prefix": "test-bucket-",
        "CharacterClasses": [
          {
            "Class": "lowercase",
            "min": 1
          }
        ]
      },
      "Type": "String",
      "Label": "Bucket Name"
    },
    "ZoneId": {
      "Type": "String",
      "Label": "Zone ID",
      "AssociationProperty": "ALIYUN::ECS::Instance::ZoneId"
    },
    "AccountName": {
      "Type": "String",
      "Label": "Database username",
      "Description": "Panjangnya harus 2 hingga 16 karakter. Harus diawali dengan huruf kecil dan hanya boleh berisi huruf kecil, angka, dan garis bawah (_).",
      "ConstraintDescription": "Panjangnya harus 2 hingga 16 karakter. Harus diawali dengan huruf kecil dan hanya boleh berisi huruf kecil, angka, dan garis bawah (_).",
      "AllowedPattern": "^[a-z][a-z0-9_]{0,30}[a-z0-9]$",
      "Default": "polar_ai",
      "MaxLength": 16,
      "MinLength": 2
    },
    "AccountPassword": {
      "Type": "String",
      "Description": "Password akses database. Panjangnya harus 8 hingga 32 karakter dan harus mengandung minimal tiga dari jenis karakter berikut: huruf kapital, huruf kecil, angka, dan karakter khusus (!@#$%^&*()_+-=).",
      "Label": "Database password",
      "ConstraintDescription": "Password akses database. Panjangnya harus 8 hingga 32 karakter dan harus mengandung minimal tiga dari jenis karakter berikut: huruf kapital, huruf kecil, angka, dan karakter khusus (!@#$%^&*()_+-=).",
      "AllowedPattern": "^[0-9A-Za-z_!@#$%^&*()_+\\-=\\+]+$",
      "MinLength": 8,
      "MaxLength": 32,
      "NoEcho": true
    },
    "DBName": {
      "Type": "String",
      "Label": "Database Name",
      "AllowedPattern": "^[a-z][a-z0-9_-]{0,62}[a-z0-9]$",
      "Description": "Panjang maksimal 64 karakter. Harus diawali dengan huruf dan diakhiri dengan huruf atau angka. Dapat berisi huruf kecil, angka, tanda hubung (-), dan garis bawah (_).",
      "ConstraintDescription": "Panjang maksimal 64 karakter. Harus diawali dengan huruf dan diakhiri dengan huruf atau angka. Dapat berisi huruf kecil, angka, tanda hubung (-), dan garis bawah (_).",
      "Default": "db-test"
    },
    "PolarDBNodeClass": {
      "Type": "String",
      "Label": "PolarDB Node Specifications",
      "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": "Nama bucket Object Storage Service (OSS).",
      "Value": {
        "Ref": "BucketName"
      }
    },
    "AccountName": {
      "Description": "Username untuk database PolarDB.",
      "Value": {
        "Ref": "AccountName"
      }
    },
    "AccountPassword": {
      "NoEcho": true,
      "Description": "Password untuk database PolarDB.",
      "Value": {
        "Ref": "AccountPassword"
      }
    },
    "DBName": {
      "Description": "Nama database PolarDB.",
      "Value": {
        "Ref": "DBName"
      }
    },
    "ConnectionString": {
      "Description": "Titik akhir publik database PolarDB.",
      "Value": {
        "Fn::Sub": "${DBClusterEndpointAddress.ConnectionString}:5432"
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "Outputs": [
        "BucketName",
        "AccountName",
        "AccountPassword",
        "DBName",
        "ConnectionString"
      ],
      "ParameterGroups": [
        {
          "Parameters": [
            "ZoneId"
          ],
          "Label": {
            "default": "Basic network configuration"
          }
        },
        {
          "Parameters": [
            "BucketName"
          ],
          "Label": {
            "default": "Basic OSS configuration"
          }
        },
        {
          "Parameters": [
            "PolarDBNodeClass",
            "DBName",
            "AccountName",
            "AccountPassword"
          ],
          "Label": {
            "default": "ApsaraDB PolarDB for PostgreSQL configuration"
          }
        }
      ],
      "TemplateTags": [
        "acs:technical-solution:internet-application-development:Lakukan pengambilan cerdas multimodal secara mudah dengan SQL native-tech_solu_262"
      ],
      "Hidden": [
        "CommonName"
      ]
    }
  }
}

Untuk contoh lainnya, lihat templat publik yang menyertakan resource ini.