AWS CloudForms ElasticSearch堆栈 [英] aws cloudformation elasticsearch stack

查看:9
本文介绍了AWS CloudForms ElasticSearch堆栈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了以下模板,以根据用户输入选择环境。但我收到错误信息,因为"调用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时,应在CloudForformation中创建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'

这里可能遗漏了其他问题,但这里肯定有语法错误

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticsearch-domain.html

这篇关于AWS CloudForms ElasticSearch堆栈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆