amazon-web-services - aws cloudformation 弹性搜索堆栈
问题描述
我编写了以下模板来根据用户输入选择环境。但是我收到错误,因为“调用 CreateStack 操作时发生错误(ValidationError):模板格式错误:[/Resources/Type] 资源定义格式错误”。请指导我需要更改的内容以及语法是否格式正确.
AWSTemplateFormatVersion: 2010-09-09
Parameters:
EnvironmentValue:
AllowedValues:
- PROD
- TEST
Description: 'Please select an Environment'
Type: String
Mappings:
Environment:
PROD:
VPC: vpc-xxxxxxxx
Subnets: 'subnet-xxxxx,subnet-xxxxx,subnet-xxxx'
Securitygroups: 'sg-xxxx,sg-xxxx'
TEST:
VPC: vpc-xxxxx
Subnets: 'subnet-xxxx,subnet-xxxxx'
Securitygroups: 'sg-xxxx,sg-xxxxx'
#Conditions:
# CreatePRODStack: !Equals [!Ref EnvironmentValue, PROD]
# CreateTESTStack: !Equals [!Ref EnvironmentValue, TEST]
Resources:
Type: 'AWS::Es:Domain'
Properties:
DomainName: EPD34
ElasticsearchVersion: 6.5
ElasticsearchClusterConfig:
DedicatedMasterEnabled: 'true'
InstanceCount: '2'
ZoneAwarenessEnabled: 'true'
InstanceType: r4.xlarge.elasticsearch
DedicatedMasterType: r4.xlarge.elasticsearch
DedicatedMasterCount: '2'
EBSOptions:
EBSEnabled: true
Iops: 0
VolumeSize: 100
VolumeType: gp2
VPCOptions: !FindInMap [Environment, !Ref 'EnvironmentValue', VPC]
SubnetIds: !FindInMap [Environment, !Ref 'EnvironmentValue', Subnets]
Securitygroups: !FindInMap [Environment, !Ref 'EnvironmentValue', Securitygroups]
SnapshotOptions:
AutomatedSnapshotStartHour: '0'
Type: 'AWS::IAM::Policy'
Properties:
PolicyDocument: YAML
PolicyName: prodtest
当用户以 Prod 形式提供输入时,应在 Cloudformation 中创建 Prod 的堆栈
解决方案
我在这里看到了一些问题:
1 - 您尚未命名您的资源。2 - 您的缩进看起来不正确,这对 yaml 3 很重要 - 我相信您的 Elasticsearch 域的类型不正确。你有
Type: 'AWS::Es:Domain'
但我认为应该是
Type: AWS::Elasticsearch::Domain
以您的域为例,我认为它应该更符合以下方面:
ElasticsearchDomain:
Type: AWS::Elasticsearch::Domain
Properties:
DomainName: EPD34
ElasticsearchVersion: 6.5
ElasticsearchClusterConfig:
DedicatedMasterEnabled: 'true'
InstanceCount: '2'
ZoneAwarenessEnabled: 'true'
InstanceType: r4.xlarge.elasticsearch
DedicatedMasterType: r4.xlarge.elasticsearch
DedicatedMasterCount: '2'
EBSOptions:
EBSEnabled: true
Iops: 0
VolumeSize: 100
VolumeType: gp2
VPCOptions: !FindInMap [Environment, !Ref 'EnvironmentValue', VPC]
SubnetIds: !FindInMap [Environment, !Ref 'EnvironmentValue', Subnets]
Securitygroups: !FindInMap [Environment, !Ref 'EnvironmentValue', Securitygroups]
SnapshotOptions:
AutomatedSnapshotStartHour: '0'
我可能在这里遗漏了其他问题,但这里肯定有语法错误
推荐阅读
- c# - 带有网络凭据的 SSRS 报告的访问级别
- qt5 - 编译 QT 源导致 QMAKE 未知错误
- java - 先用深度遍历矩阵
- python - 如何将 c_uint 的 ctypes 数组转换为 numpy 数组
- javascript - QuerySelectorAll 识别所有但不向所有添加效果
- reactjs - 如何使用 mapDispatchToProps 将 texinput onchangetext 的状态分派到 reducer
- java - 如何部署 Vuejs 应用程序
- ruby - 我如何重构这段代码以使其干燥
- java - MAC 上的 Selenium Java - Edgedriver 不工作
- html - 如何使图像跨越多个列,同时让文本环绕它?