すべてのプロダクト
Search
ドキュメントセンター

Resource Orchestration Service:ALIYUN::POLARDB::Account

最終更新日:Feb 07, 2026

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 のみ。

説明

このパラメーターは、PolarDB for MySQL クラスター向けの標準アカウントにのみ適用されます。

DBName

String

いいえ

いいえ

アクセスを許可するデータベース名。

複数のデータベース名はカンマ (,) で区切ります。

説明

このパラメーターは、PolarDB for MySQL クラスター向けの標準アカウントにのみ適用されます。

PrivForAllDB

String

いいえ

いいえ

現在のクラスター内の既存のすべてのデータベースおよび今後追加されるすべてのデータベースに対する権限を付与します。

値:

  • 0 または空: 権限を付与しません。

  • 1: 付与。

説明
  • AccountPrivilege パラメーターが指定されている場合にのみ有効になります。

  • このパラメーターを 1 に設定すると、AccountPrivilege がすべてのデータベースに付与されます。

AccountType

String

いいえ

いいえ

アカウントの種類。

値:

  • Normal: 標準アカウント。

  • Super (デフォルト): 特権アカウント。

AccountPassword

String

はい

はい

パスワード。

長さは 8~32 文字です。英文字、数字、および以下の特殊文字を含めることができます:

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

戻り値

Fn::GetAtt

なし

シナリオ 1: PolarDB データベース向けの読み取り専用標準アカウントを作成します。

クイック作成

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  DBClusterId:
    Type: String
    Description: データベースアカウントを作成する ApsaraDB for POLARDB クラスターの ID。
    AssociationProperty: ALIYUN::POLARDB::DBCluster::DBClusterId
  AccountName:
    Type: String
    Description: 使用するデータベースアカウントの名前。
    Default: mytest
  AccountPassword:
    Type: String
    Description: |-
      データベースアカウントのパスワード。パスワードは以下のルールに従う必要があります:
      - 大文字、小文字、数字、および特殊文字を含む必要があります。
      - 特殊文字には感嘆符 (!)、シャープ記号 (#)、ドル記号 ($)、パーセント記号 (%)、キャレット (^)、アンパサンド (&)、アスタリスク (*)、括弧 (())、アンダースコア (_)、プラス記号 (+)、ハイフン (-)、等号 (=) が含まれます。
      - 長さは 8~32 文字である必要があります。
    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": "データベースアカウントを作成する ApsaraDB for POLARDB クラスターの ID。"
    },
    "AccountName": {
      "Type": "String",
      "Description": "使用するデータベースアカウントの名前。",
      "Default": "mytest"
    },
    "AccountPassword": {
      "Type": "String",
      "Description": "データベースアカウントのパスワード。パスワードは以下のルールに従う必要があります:\n- 大文字、小文字、数字、および特殊文字を含む必要があります。\n- 特殊文字には感嘆符 (!)、シャープ記号 (#)、ドル記号 ($)、パーセント記号 (%)、キャレット (^)、アンパサンド (&)、アスタリスク (*)、括弧 (())、アンダースコア (_)、プラス記号 (+)、ハイフン (-)、等号 (=) が含まれます。\n- 長さは 8~32 文字である必要があります。",
      "MinLength": 8,
      "MaxLength": 32
    }
  },
  "Resources": {
    "Account": {
      "Type": "ALIYUN::POLARDB::Account",
      "Properties": {
        "DBClusterId": {
          "Ref": "DBClusterId"
        },
        "AccountName": {
          "Ref": "AccountName"
        },
        "AccountPrivilege": "ReadOnly",
        "AccountPassword": {
          "Ref": "AccountPassword"
        },
        "AccountType": "Normal"
      }
    }
  }
}

シナリオ 2: PolarDB データベース向けの特権アカウントを作成します。

クイック作成

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  DBClusterId:
    Type: String
    Description: データベースアカウントを作成する ApsaraDB for POLARDB クラスターの ID。
    AssociationProperty: ALIYUN::POLARDB::DBCluster::DBClusterId
  AccountName:
    Type: String
    Description: 使用するデータベースアカウントの名前。
    Default: mytest
  AccountPassword:
    Type: String
    Description: |-
      データベースアカウントのパスワード。パスワードは以下のルールに従う必要があります:
      - 大文字、小文字、数字、および特殊文字を含む必要があります。
      - 特殊文字には感嘆符 (!)、シャープ記号 (#)、ドル記号 ($)、パーセント記号 (%)、キャレット (^)、アンパサンド (&)、アスタリスク (*)、括弧 (())、アンダースコア (_)、プラス記号 (+)、ハイフン (-)、等号 (=) が含まれます。
      - 長さは 8~32 文字である必要があります。
    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": "データベースアカウントを作成する ApsaraDB for POLARDB クラスターの ID。",
      "AssociationProperty": "ALIYUN::POLARDB::DBCluster::DBClusterId"
    },
    "AccountName": {
      "Type": "String",
      "Description": "使用するデータベースアカウントの名前。",
      "Default": "mytest"
    },
    "AccountPassword": {
      "Type": "String",
      "Description": "データベースアカウントのパスワード。パスワードは以下のルールに従う必要があります:\n- 大文字、小文字、数字、および特殊文字を含む必要があります。\n- 特殊文字には感嘆符 (!)、シャープ記号 (#)、ドル記号 ($)、パーセント記号 (%)、キャレット (^)、アンパサンド (&)、アスタリスク (*)、括弧 (())、アンダースコア (_)、プラス記号 (+)、ハイフン (-)、等号 (=) が含まれます。\n- 長さは 8~32 文字である必要があります。",
      "MinLength": 8,
      "MaxLength": 32
    }
  },
  "Resources": {
    "Account": {
      "Type": "ALIYUN::POLARDB::Account",
      "Properties": {
        "DBClusterId": {
          "Ref": "DBClusterId"
        },
        "AccountName": {
          "Ref": "AccountName"
        },
        "AccountPrivilege": "ReadWrite",
        "AccountPassword": {
          "Ref": "AccountPassword"
        },
        "AccountType": "Super"
      }
    }
  }
}

シナリオ 3: ネイティブ SQL を使用してマルチモーダルなインテリジェント検索を簡単に実装します。

クイック作成

ROSTemplateFormatVersion: '2015-09-01'
Description: ネイティブ SQL を使用してマルチモーダルなインテリジェント検索を簡単に実行します。
Parameters:
  CommonName:
    Type: String
    Default: SmartSearch
  BucketName:
    AssociationProperty: AutoCompleteInput
    AssociationPropertyMetadata:
      Length: 6
      Prefix: test-bucket-
      CharacterClasses:
        - Class: lowercase
          min: 1
    Type: String
    Label: バケット名
  ZoneId:
    Type: String
    Label: ゾーン ID
    AssociationProperty: ALIYUN::ECS::Instance::ZoneId
  AccountName:
    Type: String
    Label: データベースユーザー名
    Description: 長さは 2~16 文字である必要があります。英小文字で始める必要があり、英小文字、数字、およびアンダースコア (_) のみを含めることができます。
    ConstraintDescription: 長さは 2~16 文字である必要があります。英小文字で始める必要があり、英小文字、数字、およびアンダースコア (_) のみを含めることができます。
    AllowedPattern: '^[a-z][a-z0-9_]{0,30}[a-z0-9]$'
    Default: polar_ai
    MaxLength: 16
    MinLength: 2
  AccountPassword:
    Type: String
    Description: データベースへのアクセスパスワード。長さは 8~32 文字である必要があり、大文字、小文字、数字、および特殊文字 (!@#$%^&*()_+-=) のうち少なくとも 3 種類を含む必要があります。
    Label: データベースパスワード
    ConstraintDescription: データベースへのアクセスパスワード。長さは 8~32 文字である必要があり、大文字、小文字、数字、および特殊文字 (!@#$%^&*()_+-=) のうち少なくとも 3 種類を含む必要があります。
    AllowedPattern: '^[0-9A-Za-z_!@#$%^&*()_+\-=\+]+$'
    MinLength: 8
    MaxLength: 32
    NoEcho: true
  DBName:
    Type: String
    Label: データベース名
    AllowedPattern: ^[a-z][a-z0-9_-]{0,62}[a-z0-9]$
    Description: 長さは最大 64 文字である必要があります。英文字で始まり、英文字または数字で終わる必要があります。英小文字、数字、ハイフン (-)、およびアンダースコア (_) を含めることができます。
    ConstraintDescription: 長さは最大 64 文字である必要があります。英文字で始まり、英文字または数字で終わる必要があります。英小文字、数字、ハイフン (-)、およびアンダースコア (_) を含めることができます。
    Default: db-test
  PolarDBNodeClass:
    Type: String
    Label: PolarDB ノード仕様
    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: Object Storage Service (OSS) バケットの名前。
    Value:
      Ref: BucketName
  AccountName:
    Description: PolarDB データベースのユーザー名。
    Value:
      Ref: AccountName
  AccountPassword:
    NoEcho: true
    Description: PolarDB データベースのパスワード。
    Value:
      Ref: AccountPassword
  DBName:
    Description: PolarDB データベースの名前。
    Value:
      Ref: DBName
  ConnectionString:
    Description: PolarDB データベースのパブリックエンドポイント。
    Value:
      Fn::Sub: ${DBClusterEndpointAddress.ConnectionString}:5432
Metadata:
  ALIYUN::ROS::Interface:
    Outputs:
      - BucketName
      - AccountName
      - AccountPassword
      - DBName
      - ConnectionString
    ParameterGroups:
      - Parameters:
          - ZoneId
        Label:
          default: 基本ネットワーク構成
      - Parameters:
          - BucketName
        Label:
          default: 基本 OSS 構成
      - Parameters:
          - PolarDBNodeClass
          - DBName
          - AccountName
          - AccountPassword
        Label:
          default: ApsaraDB PolarDB for PostgreSQL 構成
    TemplateTags:
      - acs:technical-solution:internet-application-development:ネイティブSQLによるマルチモーダルインテリジェント検索の簡単実装-tech_solu_262
    Hidden:
      - CommonName
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "ネイティブ SQL を使用してマルチモーダルなインテリジェント検索を簡単に実行します。",
  "Parameters": {
    "CommonName": {
      "Type": "String",
      "Default": "SmartSearch"
    },
    "BucketName": {
      "AssociationProperty": "AutoCompleteInput",
      "AssociationPropertyMetadata": {
        "Length": 6,
        "Prefix": "test-bucket-",
        "CharacterClasses": [
          {
            "Class": "lowercase",
            "min": 1
          }
        ]
      },
      "Type": "String",
      "Label": "バケット名"
    },
    "ZoneId": {
      "Type": "String",
      "Label": "ゾーン ID",
      "AssociationProperty": "ALIYUN::ECS::Instance::ZoneId"
    },
    "AccountName": {
      "Type": "String",
      "Label": "データベースユーザー名",
      "Description": "長さは 2~16 文字である必要があります。英小文字で始める必要があり、英小文字、数字、およびアンダースコア (_) のみを含めることができます。",
      "ConstraintDescription": "長さは 2~16 文字である必要があります。英小文字で始める必要があり、英小文字、数字、およびアンダースコア (_) のみを含めることができます。",
      "AllowedPattern": "^[a-z][a-z0-9_]{0,30}[a-z0-9]$",
      "Default": "polar_ai",
      "MaxLength": 16,
      "MinLength": 2
    },
    "AccountPassword": {
      "Type": "String",
      "Description": "データベースへのアクセスパスワード。長さは 8~32 文字である必要があり、大文字、小文字、数字、および特殊文字 (!@#$%^&*()_+-=) のうち少なくとも 3 種類を含む必要があります。",
      "Label": "データベースパスワード",
      "ConstraintDescription": "データベースへのアクセスパスワード。長さは 8~32 文字である必要があり、大文字、小文字、数字、および特殊文字 (!@#$%^&*()_+-=) のうち少なくとも 3 種類を含む必要があります。",
      "AllowedPattern": "^[0-9A-Za-z_!@#$%^&*()_+\\-=\\+]+$",
      "MinLength": 8,
      "MaxLength": 32,
      "NoEcho": true
    },
    "DBName": {
      "Type": "String",
      "Label": "データベース名",
      "AllowedPattern": "^[a-z][a-z0-9_-]{0,62}[a-z0-9]$",
      "Description": "長さは最大 64 文字である必要があります。英文字で始まり、英文字または数字で終わる必要があります。英小文字、数字、ハイフン (-)、およびアンダースコア (_) を含めることができます。",
      "ConstraintDescription": "長さは最大 64 文字である必要があります。英文字で始まり、英文字または数字で終わる必要があります。英小文字、数字、ハイフン (-)、およびアンダースコア (_) を含めることができます。",
      "Default": "db-test"
    },
    "PolarDBNodeClass": {
      "Type": "String",
      "Label": "PolarDB ノード仕様",
      "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": "Object Storage Service (OSS) バケットの名前。",
      "Value": {
        "Ref": "BucketName"
      }
    },
    "AccountName": {
      "Description": "PolarDB データベースのユーザー名。",
      "Value": {
        "Ref": "AccountName"
      }
    },
    "AccountPassword": {
      "NoEcho": true,
      "Description": "PolarDB データベースのパスワード。",
      "Value": {
        "Ref": "AccountPassword"
      }
    },
    "DBName": {
      "Description": "PolarDB データベースの名前。",
      "Value": {
        "Ref": "DBName"
      }
    },
    "ConnectionString": {
      "Description": "PolarDB データベースのパブリックエンドポイント。",
      "Value": {
        "Fn::Sub": "${DBClusterEndpointAddress.ConnectionString}:5432"
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "Outputs": [
        "BucketName",
        "AccountName",
        "AccountPassword",
        "DBName",
        "ConnectionString"
      ],
      "ParameterGroups": [
        {
          "Parameters": [
            "ZoneId"
          ],
          "Label": {
            "default": "基本ネットワーク構成"
          }
        },
        {
          "Parameters": [
            "BucketName"
          ],
          "Label": {
            "default": "基本 OSS 構成"
          }
        },
        {
          "Parameters": [
            "PolarDBNodeClass",
            "DBName",
            "AccountName",
            "AccountPassword"
          ],
          "Label": {
            "default": "ApsaraDB PolarDB for PostgreSQL 構成"
          }
        }
      ],
      "TemplateTags": [
        "acs:technical-solution:internet-application-development:ネイティブSQLによるマルチモーダルインテリジェント検索の簡単実装-tech_solu_262"
      ],
      "Hidden": [
        "CommonName"
      ]
    }
  }
}

詳細については、「このリソースを含むパブリックテンプレート」をご参照ください。