全部產品
Search
文件中心

:ALIYUN::POLARDB::Account

更新時間:Nov 19, 2024

ALIYUN::POLARDB::Account類型用於為PolarDB資料庫建立帳號。

文法

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

屬性

屬性名稱

類型

必須

允許更新

描述

約束

DBClusterId

String

叢集ID。

AccountDescription

String

帳號描述資訊。

長度為2~256個字元。不能以http://https://開頭。

AccountName

String

帳號名。

長度不超過16個字元。以小寫英文字母開頭,可包含小寫英文字母、數字和底線(_)。

AccountPrivilege

String

帳號許可權。

取值:

  • ReadWrite(預設值):讀寫。

  • ReadOnly:唯讀。

  • DMLOnly:只允許DML。

  • DDLOnly:只允許DDL。

說明

本參數僅適用於PolarRDB MySQL叢集普通帳號。

DBName

String

授權訪問的資料庫名稱。

多個資料庫名以英文逗號(,)分隔。

說明

本參數僅適用於PolarDB MySQL叢集普通帳號。

PrivForAllDB

String

是否授權當前叢集所有庫及後續新增所有庫的許可權。

取值範圍如下:

  • 0 或不填:不授權。

  • 1:授權。

說明
  • 必須要傳入AccountPrivilege參數才會生效。

  • 當參數設定為1時,表示AccountPrivilege會被授權到所有的庫。

AccountType

String

帳號類型。

取值:

  • Normal:普通帳號。

  • Super(預設值):高許可權帳號。

AccountPassword

String

密碼。

長度為8~32個字元。可包含英文字母、數字和以下特殊字元:

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

傳回值

Fn::GetAtt

樣本

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