I am deploying a stack using a cloudformation template which creates EC2 with cloud-init section. When I deploy it, i get this error message:
The following resource(s) failed to create: [EC2Instance]. .
The requested configuration is currently not supported. Please check the documentation for supported configurations.
If I remove the "Metadata" section, everything works and an EC2 is created. Something might be misconfigured in the metadata section and I am not able to figure out what is.
I am using this documentation as a reference -> https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-init.html
AWSTemplateFormatVersion: 2010-09-09
Resources:
EC2Instance:
Type: 'AWS::EC2::Instance'
Metadata:
AWS::CloudFormation::Init:
configSets:
config:
- "config1"
- "config2"
config1:
commands:
test:
command: "echo \"hello from config 1\" > test.txt"
config2:
commands:
test:
command: "echo \"hello from config 2\" > test.txt"
Properties:
InstanceType: "t2.small"
ImageId: "ami-06b382aba6c5a4f2c"
SecurityGroupIds:
- "sg-123456"
SubnetId: "subnet-123456"
KeyName: "my-example-key"
I expect the EC2 Instance to be created but I get the following error message:
The requested configuration is currently not supported. Please check the documentation for supported configurations. (Service: AmazonEC2; Status Code: 400; Error Code: Unsupported; Request ID: --Redacted--)