【发布时间】:2019-12-25 07:51:25
【问题描述】:
我使用cloudformation 来启动一个 ec2 实例。下面是cloudformation模板:
Parameters:
KeyName:
Description: The EC2 Key Pair to allow SSH access to the instance
Type: 'AWS::EC2::KeyPair::KeyName'
Resources:
Ec2Instance:
Type: 'AWS::EC2::SpotFleet'
Properties:
SecurityGroups:
- !Ref InstanceSecurityGroup
- MyExistingSecurityGroup
KeyName: !Ref KeyName
ImageId: ami-07d0cf3af28718ef8
InstanceType: p2.8xlarge
AllocationStrategy: lowestPrice
SpotPrice: 1
InstanceSecurityGroup:
Type: 'AWS::EC2::SecurityGroup'
Properties:
GroupDescription: Enable SSH access via port 22
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: '22'
ToPort: '22'
CidrIp: 0.0.0.0/0
我在 cloudformation 中创建了一个堆栈,并从 key pair 的下拉列表中指定了 Key Name。在堆栈回滚之后,我看到此错误消息Encountered unsupported property KeyName。我想知道我的配置有什么问题?
【问题讨论】:
标签: amazon-web-services amazon-ec2 amazon-cloudformation