我已经在云形成中创建了两个 DB 子网并创建了一个 DB 子网组,在 DBSubnetGroup 中,如何添加 SubnetIds,因为子网 ID 是在运行时创建的,我如何在这里获取它们,请问有人能帮我解决这个问题吗,提前谢谢了
"ADBSubnetGroup" : {
"Type" : "AWS::RDS::DBSubnetGroup",
"Properties" : {
"DBSubnetGroupDescription" : "Subnet group for DB subnets in two AZ",
"SubnetIds" : [ ],
"Tags" : [ {"Key" : "Name", "Value" : "ADBSubnetGroup"} ]
}
}
答案1
您可以像下面这样使用它,
"ADBSubnetGroup" : {
"Type" : "AWS::RDS::DBSubnetGroup",
"Properties" : {
"DBSubnetGroupDescription" : "Subnet group for DB subnets in two AZ",
"SubnetIds" : [{"Ref": "dbprivatesubnet01"},{ "Ref" : "dbprivatesubnet02"} ],
"Tags" : [ {"Key" : "Name", "Value" : "ADBSubnetGroup"} ]
}
}
它将帮助您设置具有两个可用区的子网。