全部产品
Search
文档中心

资源编排:ALIYUN::RDS::Connection

更新时间:May 04, 2023

ALIYUN::RDS::Connection类型用于申请一条外网连接地址。

语法

{
  "Type": "ALIYUN::RDS::Connection",
  "Properties": {
    "DBInstanceId": String,
    "Port": Integer,
    "BabelfishPort": String,
    "ConnectionStringPrefix": String,
    "GeneralGroupName": String
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

DBInstanceId

String

RDS实例ID。

Port

Integer

外网连接端口。

取值范围:1000~5999。

BabelfishPort

String

Babelfish for RDS PostgreSQL TDS端口号。

说明

该参数仅适用于RDS PostgreSQL实例。关于Babelfish for RDS PostgreSQL的更多信息,请参见Babelfish简介

ConnectionStringPrefix

String

外网连接地址的前缀。

完整的外网连接地址为:前缀.引擎名.rds.aliyuncs.com。

例如:test1234.mysql.rds.aliyuncs.com。

说明

长度为5~40。不能包含汉字和非法字符(~!#%^&*=+|{};:'",<>/?),建议由字母、数字、短横线(-)组成。

GeneralGroupName

String

专属集群MySQL通用版实例所属的组名。

返回值

Fn::GetAtt

  • DBInstanceId:RDS实例ID。

  • Port:外网连接端口

  • ConnectionString:外网连接地址

  • BabelfishPort:Babelfish for RDS PostgreSQL TDS端口号。

示例

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  DBInstanceId:
    Type: String
    Description: RDS instance ID.
    Default: '****'
  Port:
    Type: Number
    Description: The port of the database service.
    MinValue: 1000
    MaxValue: 5999
    Default: 1000
Resources:
  Connection:
    Type: ALIYUN::RDS::Connection
    Properties:
      DBInstanceId:
        Ref: DBInstanceId
      Port:
        Ref: Port
Outputs:
  DBInstanceId:
    Description: RDS instance ID.
    Value:
      Fn::GetAtt:
        - Connection
        - DBInstanceId
  Port:
    Description: The port of the database service.
    Value:
      Fn::GetAtt:
        - Connection
        - Port
  ConnectionString:
    Description: Connection string
    Value:
      Fn::GetAtt:
        - Connection
        - ConnectionString
  BabelfishPort:
    Description: The name of the dedicated cluster to which the instance belongs.
    Value:
      Fn::GetAtt:
        - Connection
        - BabelfishPort

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "DBInstanceId": {
      "Type": "String",
      "Description": "RDS instance ID.",
      "Default": "****"
    },
    "Port": {
      "Type": "Number",
      "Description": "The port of the database service.",
      "MinValue": 1000,
      "MaxValue": 5999,
      "Default": 1000
    }
  },
  "Resources": {
    "Connection": {
      "Type": "ALIYUN::RDS::Connection",
      "Properties": {
        "DBInstanceId": {
          "Ref": "DBInstanceId"
        },
        "Port": {
          "Ref": "Port"
        }
      }
    }
  },
  "Outputs": {
    "DBInstanceId": {
      "Description": "RDS instance ID.",
      "Value": {
        "Fn::GetAtt": [
          "Connection",
          "DBInstanceId"
        ]
      }
    },
    "Port": {
      "Description": "The port of the database service.",
      "Value": {
        "Fn::GetAtt": [
          "Connection",
          "Port"
        ]
      }
    },
    "ConnectionString": {
      "Description": "Connection string",
      "Value": {
        "Fn::GetAtt": [
          "Connection",
          "ConnectionString"
        ]
      }
    },
    "BabelfishPort": {
      "Description": "The name of the dedicated cluster to which the instance belongs.",
      "Value": {
        "Fn::GetAtt": [
          "Connection",
          "BabelfishPort"
        ]
      }
    }
  }
}