首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >EC2云形成-错误消息

EC2云形成-错误消息
EN

Stack Overflow用户
提问于 2018-08-09 00:55:46
回答 1查看 86关注 0票数 0

这是我的cloudFormation模板。

描述:创建一个可变数量的EC2实例资源。

参数:

代码语言:javascript
复制
  InstanceCount:
    Description: Number of EC2 instances (must be between 1 and 3).
    Type: Number
    Default: 1
    MinValue: 1
    MaxValue: 3
    ConstraintDescription: Must be a number between 1 and 3.
    Description: launch EC2 instances.
    Type: AWS::EC2::Instance

InstanceType:
    Description: Launch EC2 instances.
    Type: String
    Default: t2.micro
    AllowedValues: [ t2.micro ]

Conditions:
  Launch1: !Equals [1, 1]
  Launch2: !Not [!Equals [1, !Ref InstanceCount]]
  Launch3: !Or
  - !Not [!Equals [1, !Ref InstanceCount]]
  - !Not [!Equals [2, !Ref InstanceCount]]


**Resources:**

Instance1:
    Condition: Launch1
    Type: AWS::EC2::Instance
    Properties:
      InstanceType: !Ref InstanceType
      AvailabilityZone: us-east-1a
      ImageId: ami-a4c7edb2

Instance2:
    Condition: Launch2
    Type: AWS::EC2::Instance
    Properties:
      InstanceType: !Ref InstanceType
      AvailabilityZone: us-east-1b
      ImageId: ami-a4c7edb2

Instance3:
    Condition: Launch3
    Type: AWS::EC2::Instance
    Properties:
      InstanceType: !Ref InstanceType
      AvailabilityZone: us-east-1c
      ImageId: ami-a4c7edb2

错误消息

模板包含错误。:无效的模板属性或属性InstanceType。

有人能帮我找出我为什么会犯这个错误吗?

谢谢

EN

回答 1

Stack Overflow用户

发布于 2018-08-10 16:49:49

如果您仔细观察,模板的缩进在InstanceTypeInstanceCount之后被搞乱了。就像下面提到的那样修复它,你应该做得很好。

代码语言:javascript
复制
  InstanceCount:
      Description: Number of EC2 instances (must be between 1 and 3).
      Type: Number
      Default: 1
      MinValue: 1
      MaxValue: 3
      ConstraintDescription: Must be a number between 1 and 3.
      Description: launch EC2 instances.
      Type: AWS::EC2::Instance

  InstanceType:
      Description: Launch EC2 instances.
      Type: String
      Default: t2.micro
      AllowedValues: [ t2.micro ]

希望这能有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51757463

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档