语法
{
"Type": "ALIYUN::REDIS::Connection",
"Properties": {
"ConnectionType": String,
"InstanceId": String,
"Port": Integer,
"ConnectionStringPrefix": String
}
}
属性
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
ConnectionType |
String |
是 |
否 |
服务连接类型。 |
取值:
|
InstanceId |
String |
是 |
否 |
实例ID。 |
无 |
Port |
Integer |
是 |
是 |
Redis服务端口。 |
取值范围:1024~65535。 |
ConnectionStringPrefix |
String |
是 |
否 |
公网连接地址的前缀。 |
需由小写英文字母与数字组成,以小写字母开头,长度为8~40个字符。
说明 公网连接地址格式为:<前缀>.redis.rds.aliyuncs.com 。
|
返回值
Fn::GetAtt
ConnectionString:数据库连接地址。
示例
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
InstanceId:
Type: String
Description: Instance ID (globally unique)
Resources:
Connection:
Type: ALIYUN::REDIS::Connection
Properties:
ConnectionType: Public
InstanceId:
Ref: InstanceId
Port: 1743
ConnectionStringPrefix: demo
Outputs:
ConnectionString:
Description: The allocated connection string.
Value:
Fn::GetAtt:
- Connection
- ConnectionString
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"InstanceId": {
"Type": "String",
"Description": "Instance ID (globally unique)"
}
},
"Resources": {
"Connection": {
"Type": "ALIYUN::REDIS::Connection",
"Properties": {
"ConnectionType": "Public",
"InstanceId": {
"Ref": "InstanceId"
},
"Port": 1743,
"ConnectionStringPrefix": "demo"
}
}
},
"Outputs": {
"ConnectionString": {
"Description": "The allocated connection string.",
"Value": {
"Fn::GetAtt": [
"Connection",
"ConnectionString"
]
}
}
}
}