全部产品
Search
文档中心

Resource Orchestration Service:ALIYUN::RDS::Account

更新时间:Jan 17, 2026

Gunakan ALIYUN::RDS::Account untuk membuat akun manajemen database.

Sintaksis

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

Properti

Property name

Type

Required

Updatable

Description

Constraints

AccountDescription

String

No

Yes

Deskripsi akun.

Deskripsi harus terdiri dari 2 hingga 256 karakter. Deskripsi harus diawali dengan huruf atau karakter Tionghoa, dan dapat berisi huruf, karakter Tionghoa, angka, garis bawah (_), serta tanda hubung (-).

DBInstanceId

String

Yes

No

ID instans.

None

AccountPassword

String

Yes

No

Password untuk akun.

Password harus terdiri dari 8 hingga 32 karakter. Password harus mengandung minimal tiga jenis karakter berikut: huruf kapital, huruf kecil, angka, dan karakter khusus. Karakter khusus yang didukung adalah:

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

AccountType

String

No

No

Jenis akun.

Nilai yang valid:

  • Normal (default): Akun standar.

  • Super: Akun istimewa.

    Catatan

    Anda tidak dapat menghapus akun istimewa pada instans ApsaraDB RDS for SQL Server.

AccountName

String

Yes

No

Nama akun.

None

Nilai kembalian

Fn::GetAtt

AccountName: Nama akun.

Contoh

Skenario 1: Membuat akun manajemen database standar untuk instans RDS yang sudah ada

ROSTemplateFormatVersion: '2015-09-01'
Description: Create a standard database management account for an existing RDS instance.
Parameters:
  RDSInstance:
    AssociationProperty: ALIYUN::RDS::Instance::InstanceId
    Type: String
    Label: RDS Instance ID
  RdsAccountName:
    Default: db_root
    Type: String
    Description: The name of the database account.
    Label: Account name
  RdsAccountPassword:
    Type: String
    NoEcho: true
    Description: |-
      The password must be 8 to 32 characters in length. It must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. The supported special characters are:
      !@#$&%^*()_+-= .
    Label: Account password
Outputs: {}
Resources:
  RdsAccount:
    Type: ALIYUN::RDS::Account
    Properties:
      DBInstanceId:
        Ref: RDSInstance
      AccountPassword:
        Ref: RdsAccountPassword
      AccountType: Normal
      AccountName:
        Ref: RdsAccountName
Metadata: {}
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "Create a standard database management account for an existing RDS instance.",
  "Parameters": {
    "RDSInstance": {
      "AssociationProperty": "ALIYUN::RDS::Instance::InstanceId",
      "Type": "String",
      "Label": "RDS Instance ID"
    },
    "RdsAccountName": {
      "Default": "db_root",
      "Type": "String",
      "Description": "The name of the database account.",
      "Label": "Account name"
    },
    "RdsAccountPassword": {
      "Type": "String",
      "NoEcho": true,
      "Description": "The password must be 8 to 32 characters in length. It must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. The supported special characters are:\n!@#$&%^*()_+-= .",
      "Label": "Account password"
    }
  },
  "Outputs": {},
  "Resources": {
    "RdsAccount": {
      "Type": "ALIYUN::RDS::Account",
      "Properties": {
        "DBInstanceId": {
          "Ref": "RDSInstance"
        },
        "AccountPassword": {
          "Ref": "RdsAccountPassword"
        },
        "AccountType": "Normal",
        "AccountName": {
          "Ref": "RdsAccountName"
        }
      }
    }
  },
  "Metadata": {}
}

Skenario 2: Membuat instans RDS dan akun manajemen database istimewa

ROSTemplateFormatVersion: '2015-09-01'
Description: Create a pay-as-you-go ApsaraDB RDS for MySQL Serverless instance and create a database and a database account for the instance.
Parameters:
  VpcId:
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
    Type: String
    Description: The ID of the virtual private cloud (VPC) to which the RDS instance belongs.
    Label: VPC ID
  RdsAccountName:
    Default: db_root
    Type: String
    Description: The name of the database account.
    Label: Account name
  ZoneId:
    AssociationProperty: ALIYUN::ECS::Instance::ZoneId
    Type: String
    Label: Primary zone
  VSwitch:
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    AssociationPropertyMetadata:
      VpcId: ${VpcId}
      ZoneId: ${ZoneId}
    Type: String
    Description: The ID of the vSwitch.
    Label: vSwitch ID
  DBInstanceClass:
    Default: mysql.n2.serverless.1c
    AssociationProperty: ALIYUN::RDS::Instance::InstanceType
    AssociationPropertyMetadata:
      Engine: MySQL
      EngineVersion: '8.0'
      InstanceChargeType: Serverless
      DBInstanceStorageType: cloud_essd
      ZoneId: ${ZoneId}
    Type: String
    Label: Instance type
  RdsAccountPassword:
    Type: String
    NoEcho: true
    Description: |-
      The password must be 8 to 32 characters in length. It must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. The supported special characters are:
      !@#$&%^*()_+-= .
    Label: Account password
Outputs:
  PublicConnectionString:
    Value:
      Fn::GetAtt:
        - RDSInstance
        - PublicConnectionString
  InnerIPAddress:
    Value:
      Fn::GetAtt:
        - RDSInstance
        - InnerIPAddress
  AccountName:
    Value:
      Fn::GetAtt:
        - RdsAccount
        - AccountName
  PublicIPAddress:
    Value:
      Fn::GetAtt:
        - RDSInstance
        - PublicIPAddress
  DBName:
    Value:
      Fn::GetAtt:
        - Database
        - DBName
  InnerConnectionString:
    Value:
      Fn::GetAtt:
        - RDSInstance
        - InnerConnectionString
Resources:
  RDSInstance:
    Type: ALIYUN::RDS::DBInstance
    Properties:
      Category: serverless_basic
      Engine: MySQL
      DBInstanceStorage: 20
      ServerlessConfig:
        MinCapacity: 0.5
        AutoPause: false
        MaxCapacity: 8
        SwitchForce: false
      DBInstanceStorageType: cloud_essd
      PayType: Serverless
      ZoneId:
        Ref: ZoneId
      VpcId:
        Ref: VpcId
      VSwitchId:
        Ref: VSwitch
      EngineVersion: '8.0'
      DBInstanceClass:
        Ref: DBInstanceClass
      SecurityIPList: 0.0.0.0/0
  RdsAccount:
    Type: ALIYUN::RDS::Account
    Properties:
      DBInstanceId:
        Ref: RDSInstance
      AccountPassword:
        Ref: RdsAccountPassword
      AccountType: Super
      AccountName:
        Ref: RdsAccountName
  Database:
    Type: ALIYUN::RDS::Database
    Properties:
      CharacterSetName: UTF8
      DBInstanceId:
        Ref: RDSInstance
      DBName: springboot_demo
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - VpcId
          - ZoneId
          - VSwitch
        Label:
          default: Network Configuration
      - Parameters:
          - DBInstanceClass
          - RdsAccountName
          - RdsAccountPassword
        Label:
          default: RDS Configuration
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "Create a pay-as-you-go ApsaraDB RDS for MySQL Serverless instance and create a database and a database account for the instance.",
  "Parameters": {
    "VpcId": {
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
      "Type": "String",
      "Description": "The ID of the virtual private cloud (VPC) to which the RDS instance belongs.",
      "Label": "VPC ID"
    },
    "RdsAccountName": {
      "Default": "db_root",
      "Type": "String",
      "Description": "The name of the database account.",
      "Label": "Account name"
    },
    "ZoneId": {
      "AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
      "Type": "String",
      "Label": "Primary zone"
    },
    "VSwitch": {
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "AssociationPropertyMetadata": {
        "VpcId": "${VpcId}",
        "ZoneId": "${ZoneId}"
      },
      "Type": "String",
      "Description": "The ID of the vSwitch.",
      "Label": "vSwitch ID"
    },
    "DBInstanceClass": {
      "Default": "mysql.n2.serverless.1c",
      "AssociationProperty": "ALIYUN::RDS::Instance::InstanceType",
      "AssociationPropertyMetadata": {
        "Engine": "MySQL",
        "EngineVersion": "8.0",
        "InstanceChargeType": "Serverless",
        "DBInstanceStorageType": "cloud_essd",
        "ZoneId": "${ZoneId}"
      },
      "Type": "String",
      "Label": "Instance type"
    },
    "RdsAccountPassword": {
      "Type": "String",
      "NoEcho": true,
      "Description": "The password must be 8 to 32 characters in length. It must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. The supported special characters are:\n!@#$&%^*()_+-= .",
      "Label": "Account password"
    }
  },
  "Outputs": {
    "PublicConnectionString": {
      "Value": {
        "Fn::GetAtt": [
          "RDSInstance",
          "PublicConnectionString"
        ]
      }
    },
    "InnerIPAddress": {
      "Value": {
        "Fn::GetAtt": [
          "RDSInstance",
          "InnerIPAddress"
        ]
      }
    },
    "AccountName": {
      "Value": {
        "Fn::GetAtt": [
          "RdsAccount",
          "AccountName"
        ]
      }
    },
    "PublicIPAddress": {
      "Value": {
        "Fn::GetAtt": [
          "RDSInstance",
          "PublicIPAddress"
        ]
      }
    },
    "DBName": {
      "Value": {
        "Fn::GetAtt": [
          "Database",
          "DBName"
        ]
      }
    },
    "InnerConnectionString": {
      "Value": {
        "Fn::GetAtt": [
          "RDSInstance",
          "InnerConnectionString"
        ]
      }
    }
  },
  "Resources": {
    "RDSInstance": {
      "Type": "ALIYUN::RDS::DBInstance",
      "Properties": {
        "Category": "serverless_basic",
        "Engine": "MySQL",
        "DBInstanceStorage": 20,
        "ServerlessConfig": {
          "MinCapacity": 0.5,
          "AutoPause": false,
          "MaxCapacity": 8,
          "SwitchForce": false
        },
        "DBInstanceStorageType": "cloud_essd",
        "PayType": "Serverless",
        "ZoneId": {
          "Ref": "ZoneId"
        },
        "VpcId": {
          "Ref": "VpcId"
        },
        "VSwitchId": {
          "Ref": "VSwitch"
        },
        "EngineVersion": "8.0",
        "DBInstanceClass": {
          "Ref": "DBInstanceClass"
        },
        "SecurityIPList": "0.0.0.0/0"
      }
    },
    "RdsAccount": {
      "Type": "ALIYUN::RDS::Account",
      "Properties": {
        "DBInstanceId": {
          "Ref": "RDSInstance"
        },
        "AccountPassword": {
          "Ref": "RdsAccountPassword"
        },
        "AccountType": "Super",
        "AccountName": {
          "Ref": "RdsAccountName"
        }
      }
    },
    "Database": {
      "Type": "ALIYUN::RDS::Database",
      "Properties": {
        "CharacterSetName": "UTF8",
        "DBInstanceId": {
          "Ref": "RDSInstance"
        },
        "DBName": "springboot_demo"
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "VpcId",
            "ZoneId",
            "VSwitch"
          ],
          "Label": {
            "default": "Network Configuration"
          }
        },
        {
          "Parameters": [
            "DBInstanceClass",
            "RdsAccountName",
            "RdsAccountPassword"
          ],
          "Label": {
            "default": "RDS Configuration"
          }
        }
      ]
    }
  }
}