All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::POLARDB::DBInstance

更新時間:Jul 10, 2023

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

Syntax

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

Properties

Property

Type

Required

Editable

Description

Constraint

DBClusterId

String

Yes

No

The cluster ID.

None.

CharacterSetName

String

Yes

No

The character set.

For more information about the valid values, see Character set tables.

DBDescription

String

No

Yes

The description of the database.

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

AccountName

String

No

No

The account name.

None.

AccountPrivilege

String

No

No

The permissions that you want to grant to the account.

Valid values:

  • ReadWrite (default)

  • ReadOnly

  • DMLOnly

  • DDLOnly

DBName

String

Yes

No

The database name.

The name can be up to 64 characters in length, and can contain letters, digits, hyphens (-), and underscores (_). It must start with a lowercase letter and end with a letter or digit.

Collate

String

No

No

The language that specifies the collation of the database.

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

  • This property must be specified for a PolarDB for Oracle or PolarDB for PostgreSQL cluster. This property is unavailable for a PolarDB for MySQL cluster. For more information, see CreateDatabase.

Ctype

String

No

No

The language that specifies the character type of the database.

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

  • The value of Ctype must be the same as the value of Collate.

  • This property is required for a PolarDB for Oracle or PolarDB for PostgreSQL cluster. This property is optional for a PolarDB for MySQL cluster. For more information, see CreateDatabase.

Return values

Fn::GetAtt

None.

Examples

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  DBClusterId:
    Type: String
    Description: The ID of the ApsaraDB for POLARDB cluster for which a database is to be created.
Resources:
  DBInstance:
    Type: ALIYUN::POLARDB::DBInstance
    Properties:
      DBClusterId:
        Ref: DBClusterId
      CharacterSetName: utf8
      AccountName: TestAccountUser
      DBName: Test

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "DBClusterId": {
      "Type": "String",
      "Description": "The ID of the ApsaraDB for POLARDB cluster for which a database is to be created."
    }
  },
  "Resources": {
    "DBInstance": {
      "Type": "ALIYUN::POLARDB::DBInstance",
      "Properties": {
        "DBClusterId": {
          "Ref": "DBClusterId"
        },
        "CharacterSetName": "utf8",
        "AccountName": "TestAccountUser",
        "DBName": "Test"
      }
    }
  }
}