All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::POLARDB::Database

更新時間:Oct 14, 2024

ALIYUN::POLARDB::Database is used to create a database in a PolarDB cluster.

Syntax

{
  "Type": "ALIYUN::POLARDB::Database",
  "Properties": {
    "CharacterSetName": String,
    "DBClusterId": String,
    "DBName": String,
    "AccountPrivilege": String,
    "AccountName": String,
    "Collate": String,
    "Ctype": String,
    "DBDescription": String
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

CharacterSetName

String

Yes

No

The character set.

For more information, see Character set tables.

DBClusterId

String

Yes

No

The ID of the cluster.

None.

DBName

String

Yes

No

The name of the database.

The name must meet the following requirements:

  • The name can contain lowercase letters, digits, hyphens (-), and underscores (_).

  • The name must start with a lowercase letter and end with a lowercase letter or a digit. The name can be up to 64 characters in length.

AccountPrivilege

String

No

No

The permissions of the account.

Valid values:

  • ReadWrite: The account can perform read and write operations on the database.

  • ReadOnly: The account can perform read-only operations on the database.

  • DMLOnly: The account can execute only DML statements.

  • DDLOnly: The account can execute only DDL statements.

  • ReadIndex: The account has the read and index permissions on the database.

If you leave this property empty, the default value ReadWrite is used.

Note
  • This property takes effect only if the AccountName property is configured.

  • This property is required for PolarDB for Oracle and PolarDB for PostgreSQL clusters.

  • This property is optional for PolarDB for MySQL clusters.

AccountName

String

No

No

The name of the account that is granted permissions to access the database.

Note
  • You can specify only a standard account. By default, privileged accounts have all permissions on all databases. You do not need to grant privileged accounts the permissions to access the database.

  • This property is required for PolarDB for Oracle and PolarDB for PostgreSQL clusters. This property is optional for PolarDB for MySQL clusters.

Collate

String

No

No

A language environment setting.

This property is used to specify the collation of the databases that are created.

Note
  • The language must be compatible with the character set that is specified by the CharacterSetName property.

  • This property is required for PolarDB for Oracle and PolarDB for PostgreSQL clusters. This property is unavailable for PolarDB for MySQL clusters.

    To view the valid values of this property, perform the following steps: Log on to the PolarDB console and click the ID of a cluster. In the left-side navigation pane, choose Settings and Management > Databases. Then, click Create Database.

Ctype

String

No

No

A language environment setting.

This property is used to specify the character type of the database.

Note
  • The language must be compatible with the character set that is specified by the CharacterSetName property.

  • The value of this property must be the same as the value of the Collate property.

  • This property is required for PolarDB for Oracle and PolarDB for PostgreSQL clusters. This property is optional for PolarDB for MySQL clusters.

    To view the valid values of this property, perform the following steps: Log on to the PolarDB console and click the ID of a cluster. In the left-side navigation pane, choose Settings and Management > Databases. Then, click Create Database.

DBDescription

String

No

Yes

The description of the database.

The description must meet the following requirements:

  • The description cannot start with http:// or https://.

  • The description must be 2 to 256 characters in length.

Note

This property is required for PolarDB for Oracle and PolarDB for PostgreSQL clusters. This property is optional for PolarDB for MySQL clusters.

Return values

Fn::GetAtt

None.

Examples

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  CharacterSetName:
    AssociationPropertyMetadata:
      AutoChangeType: false
    Type: String
    Description:
      en: The character set of the database. For more information, see Character sets.
    AllowedValues:
      - utf8
      - geostd8
      - gbk
      - greek
      - utf8mb4
      - hebrew
      - latin1
      - hp8
      - euckr
      - keybcs2
      - armscii8
      - koi8r
      - ascii
      - koi8u
      - big5
      - latin2
      - binary
      - latin5
      - cp1250
      - latin7
      - cp1251
      - macce
      - cp1256
      - macroman
      - cp1257
      - sjis
      - cp850
      - swe7
      - cp852
      - tis620
      - cp866
      - ucs2
      - cp932
      - ujis
      - dec8
      - utf16
      - eucjpms
      - utf16le
      - gb2312
    Required: true
  DBClusterId:
    AssociationProperty: ALIYUN::POLARDB::DBCluster::DBClusterId
    Type: String
    Description:
      en: The ID of the ApsaraDB for POLARDB cluster for which a database is to be created.
    Required: true
  DBName:
    Type: String
    Description:
      en: |-
        The name of the database to be created. The name must comply with the following rules:
        It must start with a lowercase letter and consist of lowercase letters, digits, hyphens
        (-), and underscores (_).
        It must end with a letter or a digit. It can be up to 64 characters in length.
    AllowedPattern: ^[a-z0-9][-_a-z0-9]{0,63}(?<![-_]$)$
    Required: true
Resources:
  Database:
    Type: ALIYUN::POLARDB::Database
    Properties:
      CharacterSetName:
        Ref: CharacterSetName
      DBClusterId:
        Ref: DBClusterId
      DBName:
        Ref: DBName
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "CharacterSetName": {
      "AssociationPropertyMetadata": {
        "AutoChangeType": false
      },
      "Type": "String",
      "Description": {
        "en": "The character set of the database. For more information, see Character sets."
      },
      "AllowedValues": [
        "utf8",
        "geostd8",
        "gbk",
        "greek",
        "utf8mb4",
        "hebrew",
        "latin1",
        "hp8",
        "euckr",
        "keybcs2",
        "armscii8",
        "koi8r",
        "ascii",
        "koi8u",
        "big5",
        "latin2",
        "binary",
        "latin5",
        "cp1250",
        "latin7",
        "cp1251",
        "macce",
        "cp1256",
        "macroman",
        "cp1257",
        "sjis",
        "cp850",
        "swe7",
        "cp852",
        "tis620",
        "cp866",
        "ucs2",
        "cp932",
        "ujis",
        "dec8",
        "utf16",
        "eucjpms",
        "utf16le",
        "gb2312"
      ],
      "Required": true
    },
    "DBClusterId": {
      "AssociationProperty": "ALIYUN::POLARDB::DBCluster::DBClusterId",
      "Type": "String",
      "Description": {
        "en": "The ID of the ApsaraDB for POLARDB cluster for which a database is to be created."
      },
      "Required": true
    },
    "DBName": {
      "Type": "String",
      "Description": {
        "en": "The name of the database to be created. The name must comply with the following rules:\nIt must start with a lowercase letter and consist of lowercase letters, digits, hyphens\n(-), and underscores (_).\nIt must end with a letter or a digit. It can be up to 64 characters in length."
      },
      "AllowedPattern": "^[a-z0-9][-_a-z0-9]{0,63}(?<![-_]$)$",
      "Required": true
    },
  },
  "Resources": {
    "Database": {
      "Type": "ALIYUN::POLARDB::Database",
      "Properties": {
        "CharacterSetName": {
          "Ref": "CharacterSetName"
        },
        "DBClusterId": {
          "Ref": "DBClusterId"
        },
        "DBName": {
          "Ref": "DBName"
        }
      }
    }
  }
}