Shivkumar Mallesappa
Shivkumar Mallesappa

Reputation: 3077

CloudFormation: "The requested configuration is currently not supported"

I am trying to create a EC2 Instance using CloudFormation. Following is my configuration file.

Description:  This script create EC2 with Public IP

Resources:

  EC2CloudFormation:
    Type: 'AWS::EC2::Instance'
    Properties:
      AvailabilityZone: !Select 
        - '0'
        - !GetAZs ''
      IamInstanceProfile: !Ref EC2CloudformationInstanceProfilee
      ImageId: 'ami-06f1fab1ab342f0f7'
      InstanceType: t2.medium
      KeyName: mykey
      NetworkInterfaces: 
        - AssociatePublicIpAddress: "true"
          DeviceIndex: "0"
          GroupSet: 
            - 'sg-XXXXXXXXXXXXX'
          SubnetId: 'subnet-XXXXXXXXXXX'

  EC2Role:
    Type: 'AWS::IAM::Role'
    Properties:
      RoleName: EC2CloudFormationRole
      Description: Role for CloudFormation EC2 Instance
      AssumeRolePolicyDocument:
        Statement:
          - Effect: Allow
            Principal:
              Service:
                - ec2.amazonaws.com
            Action:
              - 'sts:AssumeRole'
      Path: /

  EC2CloudformationInstanceProfilee:
    Type: 'AWS::IAM::InstanceProfile'
    Properties:
      Path: /
      Roles:
        - !Ref EC2Role

  EC2CloudFormationPolicies:
    Type: 'AWS::IAM::Policy'
    Properties:
      PolicyName: EC2CloudFormationPolicy
      PolicyDocument:
        Statement:
          - Sid: Stmt1566203227305
            Action:
              - 'cloudformation:*'
            Effect: Allow
            Resource: '*'
      Roles:
        - !Ref EC2Role

But I am facing the following error :

The requested configuration is currently not supported. Please check the documentation for supported configurations. (Service: AmazonEC2; Status Code: 400; Error Code: Unsupported; Request ID: c7edeeb4-14e1-48b3-a90a-4ea79498b1e8)

I am not able to understand root cause of the issue. The other resources ( Role, Instance Profile and Policy ) are getting created only EC2::Instance is not getting created.

Upvotes: 0

Views: 917

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 270294

Your template worked perfectly fine for me.

I substituted:

  • AMI (since yours is not public)
  • Security Group
  • Subnet (matching the first AZ)

It ran just fine, so your issue is likely to be one of the above.

Upvotes: 1

Related Questions