我有一個CloudFormation腳本,用於創建RDS實例並請求子網組。但不是讓用戶逐個指定子網並創建一個新的組,我想選擇一個現有的組。請求AWS CloudFormation腳本中的現有子網組
現在我有這個子網組:
"DatabaseSubnets": {
"Description": "The subnets to place database instances in.",
"Type": "List<AWS::EC2::Subnet::Id>"
},
....
"DatabaseSubnetGroup": {
"Type": "AWS::RDS::DBSubnetGroup",
"Properties": {
"DBSubnetGroupDescription": "CloudFormation managed DB subnet group.",
"SubnetIds": {
"Ref": "DatabaseSubnets"
}
}
},
我如何改變它,選擇現有的組?我應該用Ref
替換"Properties"
組嗎?
我更想着傳遞子網組ID作爲參數。 – sashoalm
DBSubnetGroup只接受子網ID。看到這裏:http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbsubnet-group.html 如果你想重新使用現有的RDS,那麼你可以通過DBSubnetGroupName參數傳入:http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-dbsubnetgroupname和http:// docs。 aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-dbsubnetgroupname – n00b