I use cloudformation
to launch a ec2 instance. Below is the cloudformation template:
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
I created a stack in cloudformation and specify the Key Name
from a drop list of key pair
. After than the stack rolled back and I see this error message Encountered unsupported property KeyName
. I wonder what wrong with my configuration?