gpt4 book ai didi

aws-cloudformation - cloudformation 错误 - 属性 SubnetIds 的值必须是字符串列表类型

转载 作者:行者123 更新时间:2023-12-02 16:50:03 24 4
gpt4 key购买 nike

当我运行 create-stack 时,创建 elasticsearch 域失败并出现此错误 - “属性 SubnetIds 的值必须是字符串列表类型”这是 CF 模板的片段...

Parameters:
SubnetIds:
Type: 'List<AWS::EC2::Subnet::Id>'
Description: Select a VPC subnet to place the instance. Select Multiple Subnets for multi-AZ deployments

Resources:
ElasticsearchDomain:
Type: 'AWS::Elasticsearch::Domain'
Properties:
AccessPolicies:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
AWS: '*'
Action:
- 'es:ESHttp*'
Resource: !Sub 'arn:aws:es:${AWS::Region}:${AWS::AccountId}:domain/${DomainName}/*'
DomainName: !Ref 'DomainName'
EBSOptions:
EBSEnabled: !Ref EBSEnabled
VolumeSize: !Ref EBSVolumeSize
VolumeType: gp2
ElasticsearchClusterConfig:
DedicatedMasterCount: !If [HasDedicatedMasterNodes, !Ref DedicatedMasterCount, !Ref 'AWS::NoValue']
DedicatedMasterEnabled: !If [HasDedicatedMasterNodes, true, false]
DedicatedMasterType: !If [HasDedicatedMasterNodes, !Ref DedicatedMasterType, !Ref 'AWS::NoValue']
InstanceCount: !Ref ClusterInstanceCount
InstanceType: !Ref ClusterInstanceType
ZoneAwarenessEnabled: !If [HasSingleClusterInstance, false, true]
ElasticsearchVersion: !Ref ElasticsearchVersion
EncryptionAtRestOptions: !If [HasKmsKey, {Enabled: true, KmsKeyId: !Ref KMSEncryptionKey}, !Ref 'AWS::NoValue']
SnapshotOptions:
AutomatedSnapshotStartHour: 0
VPCOptions:
SecurityGroupIds:
- !Ref SecurityGroup
SubnetIds:
- !Ref SubnetIds

也尝试过这样的方法,但不起作用 -

        SubnetIds:
- [!Ref SubnetIds]

最佳答案

尝试使用以下代码片段:

  VPCOptions:
SubnetIds: !Ref ESSubnetsID
SecurityGroupIds: !Ref ESSecurityGroup

并使用以下内容更新参数部分:

  ESSubnetsID:
Description: Choose which subnets the Elasticsearch cluster should use
Type: 'List<AWS::EC2::Subnet::Id>'
Default: 'subnet-1,subnet-2'
ESSecurityGroup:
Description: Select the SecurityGroup to use for the Elasticsearch cluster
Type: 'List<AWS::EC2::SecurityGroup::Id>'
Default: 'sg-1,sg-2'

确保您传递子网 ID 的列表

关于aws-cloudformation - cloudformation 错误 - 属性 SubnetIds 的值必须是字符串列表类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59120539/

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