I was trying to create an EC2 instance with the existing values in my AWS account. The CloudFormation console says the template is valid. But when I try to create the stack, it failed with the below error:
CREATE_FAILED AWS::EC2::Instance Ec2Instance The requested configuration is currently not supported. Please check the documentation for supported configurations.**
Can someone help me out with the error. My CloudFormation template is shown below.
Thankyou.
AWSTemplateFormatVersion: 2010-09-09
Description: CloudFormation template for creating an ec2 instance
Parameters:
VPC:
Description: 'vpc'
Type: List<AWS::EC2::VPC::Id>
AvailabilityZone:
Description: 'test a-z'
Type: List<AWS::EC2::AvailabilityZone::Name>
KeyName:
Description: Key Pair name
Type: AWS::EC2::KeyPair::KeyName
Default: kskey-1
InstanceType:
Description: 'The instance type for the EC2 instance.'
Type: String
Default: t2.micro
AllowedValues:
- t2.micro
- t2.small
- t2.medium
Name:
Description: 'Then name of the EC2 instance'
Type: String
Default: 'KS-Test'
Subnet:
Description: ' The subnet id'
Type: String
SecurityGroups:
Description: 'The security group'
Type: List<AWS::EC2::SecurityGroup::Id>
Mappings:
RegionMap:
ap-south-1:
AMI: ami-b46f48db
Resources:
Ec2Instance:
Type: 'AWS::EC2::Instance'
Properties:
SecurityGroupIds: !Ref SecurityGroups
KeyName: !Ref KeyName
ImageId: !FindInMap
- RegionMap
- !Ref 'AWS::Region'
- AMI
SubnetId: !Ref Subnet