All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::POLARDB::Account

Last Updated:Dec 10, 2024

ALIYUN::POLARDB::Account is used to create a database account for a specified PolarDB cluster.

Syntax

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

Properties

Property

Type

Required

Editable

Description

Constraint

DBClusterId

String

Yes

No

The cluster ID.

None.

AccountDescription

String

No

Yes

The description of the database account.

The description must be 2 to 256 characters in length. It cannot start with http:// or https://.

AccountName

String

Yes

No

The name of the database account.

The name can be up to 16 characters in length and can contain lowercase letters, digits, and underscores (_). It must start with a lowercase letter.

AccountPrivilege

String

No

No

The permissions of the database account.

Valid values:

  • ReadWrite (default)

  • ReadOnly

  • DMLOnly

  • DDLOnly

Note

This property takes effect only when AccountType is set to Normal.

DBName

String

No

No

The name of the database on which you want to grant permissions.

Separate multiple database names with commas (,).

Note

This property takes effect only when AccountType is set to Normal.

PrivForAllDB

String

No

No

Specifies whether to grant the specified account the required permissions on all existing databases in the current cluster and databases that will be further created for the current cluster.

Valid values:

  • 0 or Null: does not grant the specified account the required permissions on all existing databases in the current cluster and databases that will be further created for the current cluster.

  • 1: grants the specified account the required permissions on all existing databases in the current cluster and databases that will be further created for the current cluster.

Note
  • This property takes effect only when AccountPrivilege is specified.

  • If you set PrivForAllDB to 1, the account is granted the required permissions that are specified by AccountPrivilege on all databases in the current cluster.

AccountType

String

No

No

The type of the database account.

Valid values:

  • Normal: standard account

  • Super (default): privileged account

AccountPassword

String

Yes

Yes

The password of the database account.

The password must be 8 to 32 characters in length, and can contain letters, digits, and the following special characters:

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

Ruturn values

Fn::GetAtt

None.

Examples

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.
  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",
      "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"
      }
    }
  }
}