All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::POLARDB::AccountPrivilege

Last Updated:Jun 16, 2026

Grants a standard account the permissions to access one or more databases in a PolarDB cluster.

Syntax

{
  "Type": "ALIYUN::POLARDB::AccountPrivilege",
  "Properties": {
    "DBClusterId": String,
    "AccountPrivilege": String,
    "DBName": String,
    "AccountName": String
  }
}

Properties

Property Type Required Update allowed Description Constraints
DBClusterId String Yes No The ID of the PolarDB cluster. None.
AccountPrivilege String Yes No The permissions of the account on the database. Valid values: `ReadWrite`, `ReadOnly`, `DMLOnly`, and `DDLOnly`. The number of permissions must match the number of database names specified for `DBName`, and the permissions must correspond to the database names in sequence.
DBName String Yes No The name of the database to grant permissions on. You can specify one or more databases. Separate multiple database names with a comma (,).
AccountName String Yes No The name of the account. None.

Return value

Fn::GetAtt

None.

Examples

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Resources": {
    "AccountPrivilege": {
      "Type": "ALIYUN::POLARDB::AccountPrivilege",
      "Properties": {
        "DBClusterId": {
          "Ref": "DBClusterId"
        },
        "AccountPrivilege": {
          "Ref": "AccountPrivilege"
        },
        "DBName": {
          "Ref": "DBName"
        },
        "AccountName": {
          "Ref": "AccountName"
        }
      }
    }
  },
  "Parameters": {
    "DBClusterId": {
      "Type": "String",
      "Description": "The ID of the PolarDB cluster."
    },
    "AccountPrivilege": {
      "MinLength": 1,
      "Type": "String",
      "Description": "The permissions of the account on the database. Valid values are ReadWrite, ReadOnly, DMLOnly, and DDLOnly. The number of permissions must be the same as the number of database names specified for DBName, and the permissions must correspond to the database names in sequence. Separate multiple permissions with a comma (,)."
    },
    "DBName": {
      "MinLength": 1,
      "Type": "String",
      "Description": "The name of the database. To grant permissions on multiple databases, separate the database names with a comma (,)."
    },
    "AccountName": {
      "MinLength": 1,
      "Type": "String",
      "Description": "The name of the account.",
      "MaxLength": 16
    }
  }
}

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Resources:
  AccountPrivilege:
    Type: ALIYUN::POLARDB::AccountPrivilege
    Properties:
      DBClusterId:
        Ref: DBClusterId
      AccountPrivilege:
        Ref: AccountPrivilege
      DBName:
        Ref: DBName
      AccountName:
        Ref: AccountName
Parameters:
  DBClusterId:
    Type: String
    Description: The ID of the PolarDB cluster.
  AccountPrivilege:
    MinLength: 1
    Type: String
    Description: The permissions of the account on the database. Valid values are ReadWrite,
      ReadOnly, DMLOnly, and DDLOnly. The number of permissions must be the same
      as the number of database names specified for DBName, and the permissions must
      correspond to the database names in sequence. Separate multiple permissions
      with a comma (,).
  DBName:
    MinLength: 1
    Type: String
    Description: The name of the database. To grant permissions on multiple databases,
      separate the database names with a comma (,).
  AccountName:
    MinLength: 1
    Type: String
    Description: The name of the account.
    MaxLength: 16