1
votes

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--)
1
@AlexHarvey Yes, This is the whole template. Did the stack get created successfully for you ?spunkyquagga
@AlexHarvey Just did that. That didn't work either :(spunkyquagga
@AlexHarvey What worked for me : If I remove the 'metadata' section and keep everything else intact, it works (even with the EBS and IAM bits intact in my original template) What doesn't work : If I add the "Metadata" section, it fails to create an EC2spunkyquagga
Thank you. I have edited it again to show only what I take to be the minimal, complete, verifiable example. Are you able to check that my simplest version also produces the error?Alex Harvey

1 Answers

3
votes

The AMI used here is ami-06b382aba6c5a4f2c, which is for 64-bit Arm. The instance type family is t2. The supported instance family for ami-06b382aba6c5a4f2c is a1.

If you want to use AMZ linux 2, use the AMI ami-0de53d8956e8dcf80, which is built for the architecture 64-bit (x86).

In a nutshell, change the ImageId to 'ami-0de53d8956e8dcf80'

Hope this helps..