Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon cloudformation cloudformation错误-属性子网的值必须是字符串列表的类型_Amazon Cloudformation - Fatal编程技术网

Amazon cloudformation cloudformation错误-属性子网的值必须是字符串列表的类型

Amazon cloudformation cloudformation错误-属性子网的值必须是字符串列表的类型,amazon-cloudformation,Amazon Cloudformation,当我运行create stack时,创建elasticsearch域失败,出现以下错误-“属性子网的值必须是字符串列表类型” 以下是CF模板的片段 Parameters: SubnetIds: Type: 'List<AWS::EC2::Subnet::Id>' Description: Select a VPC subnet to place the instance. Select Multiple Subnets for multi-AZ deploymen

当我运行create stack时,创建elasticsearch域失败,出现以下错误-“属性子网的值必须是字符串列表类型” 以下是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

请尝试使用以下代码段:

  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'
ESSubnetsID:
描述:选择Elasticsearch群集应使用的子网
键入:“列表”
默认值:“子网1,子网2”
ESSecurityGroup:
描述:选择用于Elasticsearch群集的SecurityGroup
键入:“列表”
默认值:“sg-1,sg-2”

确保传递子网ID的列表。

如错误消息所述,子网应该是字符串列表,而不是参数部分中定义的
列表。将它正确地重新定义为
列表
,它就会工作

Parameters:
  SubnetIds:
    Type: 'List<String>'
参数:
子网:
键入:“列表”

一般来说,您是对的,子网ID必须是字符串列表。但是,您仍然可以使用
列表
Parameters:
  SubnetIds:
    Type: 'List<String>'