【发布时间】:2018-08-09 00:55:46
【问题描述】:
这是我的 cloudFormation 模板。
描述:创建可变数量的 EC2 实例资源。
参数:
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]
谁能帮我找出为什么会出现这个错误?
谢谢
【问题讨论】:
-
您应该发布完整的格式正确的模板。这些类型错误是格式错误。
-
我该怎么做?
-
我可以使用相同的模板创建一个堆栈gist.github.com/sudharsans/0a9112e2afb337990388d78bef031454
标签: amazon-ec2 amazon-cloudformation