Fn:GetAtt 用于 AWS::RDS::DBSubnetGroup 对象
Fn:GetAtt for AWS::RDS::DBSubnetGroup object
我正在尝试在 VPC 中创建一个包含 AWS::RDS::DBInstance 的堆栈模板。其中一项要求是引用 DBSubnetGroupName 属性 中的子网组。 VPC 和两个子网已创建(使用可单击的 Web 界面)。如何在 DBSubnetGroupName 属性?
中引用新创建的子网组
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "THUNDER STACK TEMPLATE - MSSQL RDS",
"Parameters": {},
"Mappings" : {},
"Resources": {
"ThunderSubnetGroup": {
"Type" : "AWS::RDS::DBSubnetGroup",
"Properties" : {
"DBSubnetGroupDescription" : "popissss",
"SubnetIds" : [ "subnet-ff8450d5", "subnet-3445ff42" ]
}
},
"ThunderSG": {
"Type" : "AWS::EC2::SecurityGroup",
"Properties" : {
"GroupDescription" : "opisss",
"SecurityGroupIngress" : {
"CidrIp" : "0.0.0.0/0",
"FromPort" : "1433",
"IpProtocol" : "tcp",
"ToPort" : "1433"
},
"VpcId" : "vpc-8eaaaab"
}
},
"ThunderRDS": {
"Type": "AWS::RDS::DBInstance",
"Properties": {
"AvailabilityZone": "us-east-1b",
"Engine": "sqlserver-ex",
"EngineVersion": "12.00.4422.0.v1",
"MasterUsername": "username",
"DBInstanceClass": "db.t2.micro",
"DBInstanceIdentifier" : "thunder-rds",
"DBSubnetGroupName" : "ThunderSubnetGroup",
"AllocatedStorage": "5",
"MasterUserPassword": "password",
"VPCSecurityGroups": [{ "Fn::GetAtt": [ "ThunderSG", "GroupId" ] }]
}
}
},
"Outputs": {}
}
尝试上面的代码时出现错误:
DBSubnetGroup 'thundersubnetgroup' not found.
我也尝试使用 Fn:GetAtt 函数,但在设计器中验证模板时出现错误:
Template contains errors.: Template error: resource ThunderSubnetGroup does not support attribute type DBSubnetGroupName in Fn::GetAtt
使用:
"DBSubnetGroupName" : {"Ref": "ThunderSubnetGroup"},
另见:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html
我正在尝试在 VPC 中创建一个包含 AWS::RDS::DBInstance 的堆栈模板。其中一项要求是引用 DBSubnetGroupName 属性 中的子网组。 VPC 和两个子网已创建(使用可单击的 Web 界面)。如何在 DBSubnetGroupName 属性?
中引用新创建的子网组{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "THUNDER STACK TEMPLATE - MSSQL RDS",
"Parameters": {},
"Mappings" : {},
"Resources": {
"ThunderSubnetGroup": {
"Type" : "AWS::RDS::DBSubnetGroup",
"Properties" : {
"DBSubnetGroupDescription" : "popissss",
"SubnetIds" : [ "subnet-ff8450d5", "subnet-3445ff42" ]
}
},
"ThunderSG": {
"Type" : "AWS::EC2::SecurityGroup",
"Properties" : {
"GroupDescription" : "opisss",
"SecurityGroupIngress" : {
"CidrIp" : "0.0.0.0/0",
"FromPort" : "1433",
"IpProtocol" : "tcp",
"ToPort" : "1433"
},
"VpcId" : "vpc-8eaaaab"
}
},
"ThunderRDS": {
"Type": "AWS::RDS::DBInstance",
"Properties": {
"AvailabilityZone": "us-east-1b",
"Engine": "sqlserver-ex",
"EngineVersion": "12.00.4422.0.v1",
"MasterUsername": "username",
"DBInstanceClass": "db.t2.micro",
"DBInstanceIdentifier" : "thunder-rds",
"DBSubnetGroupName" : "ThunderSubnetGroup",
"AllocatedStorage": "5",
"MasterUserPassword": "password",
"VPCSecurityGroups": [{ "Fn::GetAtt": [ "ThunderSG", "GroupId" ] }]
}
}
},
"Outputs": {}
}
尝试上面的代码时出现错误:
DBSubnetGroup 'thundersubnetgroup' not found.
我也尝试使用 Fn:GetAtt 函数,但在设计器中验证模板时出现错误:
Template contains errors.: Template error: resource ThunderSubnetGroup does not support attribute type DBSubnetGroupName in Fn::GetAtt
使用:
"DBSubnetGroupName" : {"Ref": "ThunderSubnetGroup"},
另见:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html