我正在系結這個 cloudformation 堆疊,但是當創建到達 DBSubnetGroup 時,它失敗并顯示訊息:屬性 SubnetIds 的值必須是字串串列型別。我感謝您的幫助。除了 DBSubnetGroup 之外,一切似乎都正常。
AWSTemplateFormatVersion: 2010-09-09
Description: My First CloudFormation Template
Resources:
MyVPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 10.1.0.0/16
EnableDnsHostnames: true
EnableDnsSupport: true
InstanceTenancy: default
Tags:
- Key: Name
Value: VPC for Activity Number 1
MySubnet:
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref MyVPC
CidrBlock: 10.1.1.0/24
MapPublicIpOnLaunch: true
AvailabilityZone: "us-east-1c"
Tags:
- Key: Name
Value: Public Subnet
MySubnetA:
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref MyVPC
CidrBlock: 10.1.2.0/24
MapPublicIpOnLaunch: true
AvailabilityZone: "us-east-1a"
Tags:
- Key: Name
Value: Public Subnet A
MySubnetB:
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref MyVPC
CidrBlock: 10.1.3.0/24
MapPublicIpOnLaunch: true
AvailabilityZone: "us-east-1b"
Tags:
- Key: Name
Value: Public Subnet B
這就是創建失敗的開始:
DBSubnetGroup:
Type: AWS::RDS::DBSubnetGroup
DependsOn:
- MyVPC
- MySubnet
- MySubnetA
- MySubnetB
Properties:
DBSubnetGroupDescription: Subnets to lauch the database
SubnetIds:
-!Ref MySubnet
-!Ref MySubnetA
-!Ref MySubnetB
uj5u.com熱心網友回復:
您應該在-和 內在函式之間!Ref留一個空格,以便正確決議。遺憾的是,CloudFormation 僅在創建堆疊時檢測到這一點。
DBSubnetGroup:
Type: AWS::RDS::DBSubnetGroup
DependsOn:
- MyVPC
- MySubnet
- MySubnetA
- MySubnetB
Properties:
DBSubnetGroupDescription: Subnets to lauch the database
SubnetIds:
- !Ref MySubnet
- !Ref MySubnetA
- !Ref MySubnetB
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/324484.html
下一篇:如何從函式引數中繼承縮小的型別?
