当我运行创建堆栈时,在创建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]发布于 2019-11-30 22:44:11
尝试使用以下代码片段:
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'确保您传递子网ids的List。
发布于 2019-11-30 23:05:14
正如错误消息所述,SubnetIds应该是字符串列表,而不是在params部分中定义的List<AWS::EC2::Subnet::Id>。把它正确地定义为List<String>,它就能工作了。
Parameters:
SubnetIds:
Type: 'List<String>'https://stackoverflow.com/questions/59120539
复制相似问题