全部產品
Search
文件中心

:ALIYUN::GPDB::Account

更新時間:Jul 16, 2026

ALIYUN::GPDB::Account類型用於建立資料庫執行個體帳號。

文法

{
  "Type": "ALIYUN::GPDB::Account",
  "Properties": {
    "AccountDescription": String,
    "DBInstanceId": String,
    "AccountPassword": String,
    "AccountType": String,
    "AccountName": String
  }
}

屬性

屬性名稱

類型

必須

允許更新

描述

約束

AccountName

String

資料庫帳號名稱。

AccountPassword

String

資料庫帳號名稱的密碼。

限制:

  • 密碼由大寫字母、小寫字母、數字以及特殊符號組成。

    特殊符號包含:(!)、(@)、(#)、($)、(%)、(^)、(&)、(*)(())、(_)、(+)、(-)、(=)

  • 密碼長度為8~32個字元。

DBInstanceId

String

資料庫執行個體ID。

AccountDescription

String

資料庫帳號描述。

AccountType

String

帳號類型。

取值說明:

  • Normal:普通帳號。

  • Super:高許可權帳號。

傳回值

Fn::GetAtt

  • DBInstanceId:資料庫執行個體ID。

  • AccountName:資料庫執行個體帳號名稱。

樣本

情境 1 :為AnalyticDB PostgreSQL執行個體建立普通資料庫帳號。

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 為AnalyticDB PostgreSQL執行個體建立普通資料庫帳號。
  en: Create a normal database account for an AnalyticDB for PostgreSQL instance.
Parameters:
  DBInstanceId:
    Type: String
    Label:
      zh-cn: GPDB執行個體ID
      en: GPDB Instance ID
    Description:
      zh-cn: 已有的AnalyticDB PostgreSQL執行個體ID。
      en: The ID of an existing AnalyticDB for PostgreSQL instance.
  AccountName:
    Type: String
    Label:
      zh-cn: 帳號名稱
      en: Account Name
    Description:
      zh-cn: >-
        資料庫帳號名稱,2~16個字元,
        由小寫字母、數字和底線組成,
        以小寫字母開頭,以小寫字母或數字結尾,
        不能以gp開頭。
      en: >-
        Account name, 2-16 characters,
        consisting of lowercase letters, digits and underscores,
        starting with a lowercase letter and ending with a lowercase letter or digit.
    AllowedPattern: '^(?!gp)[a-z][a-z0-9_]{0,14}[a-z0-9]$'
  AccountPassword:
    Type: String
    Label:
      zh-cn: 帳號密碼
      en: Account Password
    Description:
      zh-cn: >-
        資料庫帳號密碼,8~32個字元,
        至少包含大寫字母、小寫字母、數字和特殊字元中的三種。
      en: >-
        Account password, 8-32 characters,
        must contain at least three of: uppercase, lowercase, digits, special characters.
    NoEcho: true
    MinLength: 8
    MaxLength: 32
Resources:
  Account:
    Type: ALIYUN::GPDB::Account
    Properties:
      DBInstanceId:
        Ref: DBInstanceId
      AccountName:
        Ref: AccountName
      AccountPassword:
        Ref: AccountPassword
Outputs:
  AccountName:
    Label:
      zh-cn: 帳號名稱
      en: Account Name
    Description:
      zh-cn: 建立成功的資料庫帳號名稱。
      en: The name of the created database account.
    Value:
      Fn::GetAtt:
        - Account
        - AccountName
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "為AnalyticDB PostgreSQL執行個體建立普通資料庫帳號。",
    "en": "Create a normal database account for an AnalyticDB for PostgreSQL instance."
  },
  "Parameters": {
    "DBInstanceId": {
      "Type": "String",
      "Label": {
        "zh-cn": "GPDB執行個體ID",
        "en": "GPDB Instance ID"
      },
      "Description": {
        "zh-cn": "已有的AnalyticDB PostgreSQL執行個體ID。",
        "en": "The ID of an existing AnalyticDB for PostgreSQL instance."
      }
    },
    "AccountName": {
      "Type": "String",
      "Label": {
        "zh-cn": "帳號名稱",
        "en": "Account Name"
      },
      "Description": {
        "zh-cn": "資料庫帳號名稱,2~16個字元,由小寫字母、數字和底線組成,以小寫字母開頭,以小寫字母或數字結尾,不能以gp開頭。",
        "en": "Account name, 2-16 characters, consisting of lowercase letters, digits and underscores, starting with a lowercase letter and ending with a lowercase letter or digit."
      },
      "AllowedPattern": "^(?!gp)[a-z][a-z0-9_]{0,14}[a-z0-9]$"
    },
    "AccountPassword": {
      "Type": "String",
      "Label": {
        "zh-cn": "帳號密碼",
        "en": "Account Password"
      },
      "Description": {
        "zh-cn": "資料庫帳號密碼,8~32個字元,至少包含大寫字母、小寫字母、數字和特殊字元中的三種。",
        "en": "Account password, 8-32 characters, must contain at least three of: uppercase, lowercase, digits, special characters."
      },
      "NoEcho": true,
      "MinLength": 8,
      "MaxLength": 32
    }
  },
  "Resources": {
    "Account": {
      "Type": "ALIYUN::GPDB::Account",
      "Properties": {
        "DBInstanceId": {
          "Ref": "DBInstanceId"
        },
        "AccountName": {
          "Ref": "AccountName"
        },
        "AccountPassword": {
          "Ref": "AccountPassword"
        }
      }
    }
  },
  "Outputs": {
    "AccountName": {
      "Label": {
        "zh-cn": "帳號名稱",
        "en": "Account Name"
      },
      "Description": {
        "zh-cn": "建立成功的資料庫帳號名稱。",
        "en": "The name of the created database account."
      },
      "Value": {
        "Fn::GetAtt": [
          "Account",
          "AccountName"
        ]
      }
    }
  }
}

情境 2 :為AnalyticDB PostgreSQL執行個體建立高許可權管理帳號。

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 為AnalyticDB PostgreSQL執行個體建立高許可權管理帳號。
  en: Create a privileged Super account for an AnalyticDB for PostgreSQL instance.
Parameters:
  DBInstanceId:
    Type: String
    Label:
      zh-cn: GPDB執行個體ID
      en: GPDB Instance ID
    Description:
      zh-cn: 已有的AnalyticDB PostgreSQL執行個體ID。
      en: The ID of an existing AnalyticDB for PostgreSQL instance.
  AccountName:
    Type: String
    Label:
      zh-cn: 管理員帳號名稱
      en: Admin Account Name
    Description:
      zh-cn: >-
        高許可權帳號名稱,2~16個字元,
        由小寫字母、數字和底線組成,
        不能以gp開頭。
      en: >-
        Super account name, 2-16 characters,
        consisting of lowercase letters, digits and underscores.
    Default: admin_user
    AllowedPattern: '^(?!gp)[a-z][a-z0-9_]{0,14}[a-z0-9]$'
  AccountPassword:
    Type: String
    Label:
      zh-cn: 帳號密碼
      en: Account Password
    Description:
      zh-cn: >-
        高許可權帳號密碼,8~32個字元,
        至少包含大寫字母、小寫字母、數字和特殊字元中的三種。
      en: >-
        Super account password, 8-32 characters,
        must contain at least three of: uppercase, lowercase, digits, special characters.
    NoEcho: true
    MinLength: 8
    MaxLength: 32
  AccountDescription:
    Type: String
    Label:
      zh-cn: 帳號描述
      en: Account Description
    Description:
      zh-cn: 資料庫管理員帳號的描述資訊。
      en: The description of the database administrator account.
    Default: GPDB高許可權管理帳號
Resources:
  SuperAccount:
    Type: ALIYUN::GPDB::Account
    Properties:
      DBInstanceId:
        Ref: DBInstanceId
      AccountName:
        Ref: AccountName
      AccountPassword:
        Ref: AccountPassword
      AccountType: Super
      AccountDescription:
        Ref: AccountDescription
Outputs:
  DBInstanceId:
    Label:
      zh-cn: GPDB執行個體ID
      en: GPDB Instance ID
    Description:
      zh-cn: 帳號所屬的資料庫執行個體ID。
      en: The ID of the database instance the account belongs to.
    Value:
      Fn::GetAtt:
        - SuperAccount
        - DBInstanceId
  AccountName:
    Label:
      zh-cn: 管理員帳號名稱
      en: Admin Account Name
    Description:
      zh-cn: 建立成功的高許可權管理帳號名稱。
      en: The name of the created privileged account.
    Value:
      Fn::GetAtt:
        - SuperAccount
        - AccountName
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "為AnalyticDB PostgreSQL執行個體建立高許可權管理帳號。",
    "en": "Create a privileged Super account for an AnalyticDB for PostgreSQL instance."
  },
  "Parameters": {
    "DBInstanceId": {
      "Type": "String",
      "Label": {
        "zh-cn": "GPDB執行個體ID",
        "en": "GPDB Instance ID"
      },
      "Description": {
        "zh-cn": "已有的AnalyticDB PostgreSQL執行個體ID。",
        "en": "The ID of an existing AnalyticDB for PostgreSQL instance."
      }
    },
    "AccountName": {
      "Type": "String",
      "Label": {
        "zh-cn": "管理員帳號名稱",
        "en": "Admin Account Name"
      },
      "Description": {
        "zh-cn": "高許可權帳號名稱,2~16個字元,由小寫字母、數字和底線組成,不能以gp開頭。",
        "en": "Super account name, 2-16 characters, consisting of lowercase letters, digits and underscores."
      },
      "Default": "admin_user",
      "AllowedPattern": "^(?!gp)[a-z][a-z0-9_]{0,14}[a-z0-9]$"
    },
    "AccountPassword": {
      "Type": "String",
      "Label": {
        "zh-cn": "帳號密碼",
        "en": "Account Password"
      },
      "Description": {
        "zh-cn": "高許可權帳號密碼,8~32個字元,至少包含大寫字母、小寫字母、數字和特殊字元中的三種。",
        "en": "Super account password, 8-32 characters, must contain at least three of: uppercase, lowercase, digits, special characters."
      },
      "NoEcho": true,
      "MinLength": 8,
      "MaxLength": 32
    },
    "AccountDescription": {
      "Type": "String",
      "Label": {
        "zh-cn": "帳號描述",
        "en": "Account Description"
      },
      "Description": {
        "zh-cn": "資料庫管理員帳號的描述資訊。",
        "en": "The description of the database administrator account."
      },
      "Default": "GPDB高許可權管理帳號"
    }
  },
  "Resources": {
    "SuperAccount": {
      "Type": "ALIYUN::GPDB::Account",
      "Properties": {
        "DBInstanceId": {
          "Ref": "DBInstanceId"
        },
        "AccountName": {
          "Ref": "AccountName"
        },
        "AccountPassword": {
          "Ref": "AccountPassword"
        },
        "AccountType": "Super",
        "AccountDescription": {
          "Ref": "AccountDescription"
        }
      }
    }
  },
  "Outputs": {
    "DBInstanceId": {
      "Label": {
        "zh-cn": "GPDB執行個體ID",
        "en": "GPDB Instance ID"
      },
      "Description": {
        "zh-cn": "帳號所屬的資料庫執行個體ID。",
        "en": "The ID of the database instance the account belongs to."
      },
      "Value": {
        "Fn::GetAtt": [
          "SuperAccount",
          "DBInstanceId"
        ]
      }
    },
    "AccountName": {
      "Label": {
        "zh-cn": "管理員帳號名稱",
        "en": "Admin Account Name"
      },
      "Description": {
        "zh-cn": "建立成功的高許可權管理帳號名稱。",
        "en": "The name of the created privileged account."
      },
      "Value": {
        "Fn::GetAtt": [
          "SuperAccount",
          "AccountName"
        ]
      }
    }
  }
}

情境 3 :為AnalyticDB PostgreSQL執行個體同時建立管理帳號和唯讀業務帳號,實現許可權分離。

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 為AnalyticDB PostgreSQL執行個體同時建立管理帳號和業務帳號,實現許可權分離。
  en: Create both a Super admin account and a Normal business account for privilege separation.
Parameters:
  DBInstanceId:
    Type: String
    Label:
      zh-cn: GPDB執行個體ID
      en: GPDB Instance ID
    Description:
      zh-cn: 已有的AnalyticDB PostgreSQL執行個體ID。
      en: The ID of an existing AnalyticDB for PostgreSQL instance.
  AdminAccountName:
    Type: String
    Label:
      zh-cn: 管理員帳號名稱
      en: Admin Account Name
    Description:
      zh-cn: >-
        高許可權管理員帳號名稱,2~16個字元,
        由小寫字母、數字和底線組成,不能以gp開頭。
      en: >-
        Super admin account name, 2-16 characters,
        lowercase letters, digits and underscores, cannot start with gp.
    Default: db_admin
    AllowedPattern: '^(?!gp)[a-z][a-z0-9_]{0,14}[a-z0-9]$'
  AdminAccountPassword:
    Type: String
    Label:
      zh-cn: 管理員帳號密碼
      en: Admin Account Password
    Description:
      zh-cn: 管理員帳號密碼,8~32個字元。
      en: Admin account password, 8-32 characters.
    NoEcho: true
    MinLength: 8
    MaxLength: 32
  BizAccountName:
    Type: String
    Label:
      zh-cn: 業務帳號名稱
      en: Business Account Name
    Description:
      zh-cn: >-
        普通業務帳號名稱,2~16個字元,
        由小寫字母、數字和底線組成,不能以gp開頭。
      en: >-
        Normal business account name, 2-16 characters,
        lowercase letters, digits and underscores, cannot start with gp.
    Default: biz_reader
    AllowedPattern: '^(?!gp)[a-z][a-z0-9_]{0,14}[a-z0-9]$'
  BizAccountPassword:
    Type: String
    Label:
      zh-cn: 業務帳號密碼
      en: Business Account Password
    Description:
      zh-cn: 業務帳號密碼,8~32個字元。
      en: Business account password, 8-32 characters.
    NoEcho: true
    MinLength: 8
    MaxLength: 32
Resources:
  AdminAccount:
    Type: ALIYUN::GPDB::Account
    Properties:
      DBInstanceId:
        Ref: DBInstanceId
      AccountName:
        Ref: AdminAccountName
      AccountPassword:
        Ref: AdminAccountPassword
      AccountType: Super
      AccountDescription: 資料庫管理員帳號,擁有執行個體管理和使用者授權許可權
  BizAccount:
    Type: ALIYUN::GPDB::Account
    DependsOn: AdminAccount
    Properties:
      DBInstanceId:
        Ref: DBInstanceId
      AccountName:
        Ref: BizAccountName
      AccountPassword:
        Ref: BizAccountPassword
      AccountType: Normal
      AccountDescription: 業務唯讀帳號,僅用於資料查詢和分析
Outputs:
  AdminAccountName:
    Label:
      zh-cn: 管理員帳號
      en: Admin Account
    Description:
      zh-cn: 建立成功的高許可權管理員帳號名稱。
      en: The name of the created Super admin account.
    Value:
      Fn::GetAtt:
        - AdminAccount
        - AccountName
  BizAccountName:
    Label:
      zh-cn: 業務帳號
      en: Business Account
    Description:
      zh-cn: 建立成功的普通業務帳號名稱。
      en: The name of the created Normal business account.
    Value:
      Fn::GetAtt:
        - BizAccount
        - AccountName
  DBInstanceId:
    Label:
      zh-cn: GPDB執行個體ID
      en: GPDB Instance ID
    Description:
      zh-cn: 帳號所屬的資料庫執行個體ID。
      en: The ID of the database instance.
    Value:
      Fn::GetAtt:
        - AdminAccount
        - DBInstanceId
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "為AnalyticDB PostgreSQL執行個體同時建立管理帳號和業務帳號,實現許可權分離。",
    "en": "Create both a Super admin account and a Normal business account for privilege separation."
  },
  "Parameters": {
    "DBInstanceId": {
      "Type": "String",
      "Label": {
        "zh-cn": "GPDB執行個體ID",
        "en": "GPDB Instance ID"
      },
      "Description": {
        "zh-cn": "已有的AnalyticDB PostgreSQL執行個體ID。",
        "en": "The ID of an existing AnalyticDB for PostgreSQL instance."
      }
    },
    "AdminAccountName": {
      "Type": "String",
      "Label": {
        "zh-cn": "管理員帳號名稱",
        "en": "Admin Account Name"
      },
      "Description": {
        "zh-cn": "高許可權管理員帳號名稱,2~16個字元,由小寫字母、數字和底線組成,不能以gp開頭。",
        "en": "Super admin account name, 2-16 characters, lowercase letters, digits and underscores, cannot start with gp."
      },
      "Default": "db_admin",
      "AllowedPattern": "^(?!gp)[a-z][a-z0-9_]{0,14}[a-z0-9]$"
    },
    "AdminAccountPassword": {
      "Type": "String",
      "Label": {
        "zh-cn": "管理員帳號密碼",
        "en": "Admin Account Password"
      },
      "Description": {
        "zh-cn": "管理員帳號密碼,8~32個字元。",
        "en": "Admin account password, 8-32 characters."
      },
      "NoEcho": true,
      "MinLength": 8,
      "MaxLength": 32
    },
    "BizAccountName": {
      "Type": "String",
      "Label": {
        "zh-cn": "業務帳號名稱",
        "en": "Business Account Name"
      },
      "Description": {
        "zh-cn": "普通業務帳號名稱,2~16個字元,由小寫字母、數字和底線組成,不能以gp開頭。",
        "en": "Normal business account name, 2-16 characters, lowercase letters, digits and underscores, cannot start with gp."
      },
      "Default": "biz_reader",
      "AllowedPattern": "^(?!gp)[a-z][a-z0-9_]{0,14}[a-z0-9]$"
    },
    "BizAccountPassword": {
      "Type": "String",
      "Label": {
        "zh-cn": "業務帳號密碼",
        "en": "Business Account Password"
      },
      "Description": {
        "zh-cn": "業務帳號密碼,8~32個字元。",
        "en": "Business account password, 8-32 characters."
      },
      "NoEcho": true,
      "MinLength": 8,
      "MaxLength": 32
    }
  },
  "Resources": {
    "AdminAccount": {
      "Type": "ALIYUN::GPDB::Account",
      "Properties": {
        "DBInstanceId": {
          "Ref": "DBInstanceId"
        },
        "AccountName": {
          "Ref": "AdminAccountName"
        },
        "AccountPassword": {
          "Ref": "AdminAccountPassword"
        },
        "AccountType": "Super",
        "AccountDescription": "資料庫管理員帳號,擁有執行個體管理和使用者授權許可權"
      }
    },
    "BizAccount": {
      "Type": "ALIYUN::GPDB::Account",
      "DependsOn": "AdminAccount",
      "Properties": {
        "DBInstanceId": {
          "Ref": "DBInstanceId"
        },
        "AccountName": {
          "Ref": "BizAccountName"
        },
        "AccountPassword": {
          "Ref": "BizAccountPassword"
        },
        "AccountType": "Normal",
        "AccountDescription": "業務唯讀帳號,僅用於資料查詢和分析"
      }
    }
  },
  "Outputs": {
    "AdminAccountName": {
      "Label": {
        "zh-cn": "管理員帳號",
        "en": "Admin Account"
      },
      "Description": {
        "zh-cn": "建立成功的高許可權管理員帳號名稱。",
        "en": "The name of the created Super admin account."
      },
      "Value": {
        "Fn::GetAtt": [
          "AdminAccount",
          "AccountName"
        ]
      }
    },
    "BizAccountName": {
      "Label": {
        "zh-cn": "業務帳號",
        "en": "Business Account"
      },
      "Description": {
        "zh-cn": "建立成功的普通業務帳號名稱。",
        "en": "The name of the created Normal business account."
      },
      "Value": {
        "Fn::GetAtt": [
          "BizAccount",
          "AccountName"
        ]
      }
    },
    "DBInstanceId": {
      "Label": {
        "zh-cn": "GPDB執行個體ID",
        "en": "GPDB Instance ID"
      },
      "Description": {
        "zh-cn": "帳號所屬的資料庫執行個體ID。",
        "en": "The ID of the database instance."
      },
      "Value": {
        "Fn::GetAtt": [
          "AdminAccount",
          "DBInstanceId"
        ]
      }
    }
  }
}