gpt4 book ai didi

string - AWS Cloudformation 属性 SubnetIds 的值必须为字符串列表类型

转载 作者:行者123 更新时间:2023-12-03 07:12:27 25 4
gpt4 key购买 nike

我正在绑定(bind)此 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



最佳答案

- 和内部函数 !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

关于string - AWS Cloudformation 属性 SubnetIds 的值必须为字符串列表类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69619261/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com