Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Non-Windows instances with a virtualization type of 'hvm' are currently not supported for this instance type : [AWS Cloudformation]

I am trying to create a an t2.micro ec2 instance with amazon linux as os using cloudformation . Following is the json file (parts that matter).

    "FileName" :{
        "Type" : "String",
        "Default" : "cf-file.sh",
        "AllowedValues": [ "cf-file.sh"]
    },
    "InstanceType" : {
      "Description" : "WebServer EC2 instance type",
      "Type" : "String",
      "Default" : "t2.micro",
      "AllowedValues" : ["t2.micro"],
      "ConstraintDescription" : "must be a valid EC2 instance type."
    },

       "AMIID" :{
         "Type": "String",
        "Default":"ami-1ecae776",
        "AllowedValues":["ami-1ecae776"]
    }
  },
  "Resources" : {
    "EC2Instance" : {
      "Type" : "AWS::EC2::Instance",
      "Properties" : {
        "UserData" : {
                "Fn::Base64" : {
                    "Fn::Join" : [ 
                            "", 
                            [
                                "#!/bin/bash\n",
                                "yes y | yum install dos2unix\n",
                                "touch ",{ "Ref" : "FileName" },"\n",
                                "chmod 777 ",{ "Ref" : "FileName" },"\n" 
                            ]
                    ]
                 } 
        },
          "KeyName" : { "Ref" : "KeyName" },
        "ImageId" : { "Ref" : "AMIID" }
      }
    },

When i run this file i get following error

Non-Windows instances with a virtualization type of 'hvm' are currently not supported for this instance type

I guess this error comes when we use t1 family instance type but i am using t2.micro. Please explain the reason why is it so ?

like image 591
Subham Tripathi Avatar asked Jul 29 '15 18:07

Subham Tripathi


People also ask

What is AWS HVM instance?

HVM (known as Hardware Virtual Machine) is the type of instance that mimics bare-metal server setup which provides better hardware isolation. With this instance type, the OS can run directly on top of the Virtual Machine without additional configuration making it to look like it is running on a real physical server.

What is virtualization type HVM?

HVM guests are fully virtualized. It means that the VMs running on top of their hypervisors are not aware that they are sharing processing time with other clients on the same hardware. The host should have the capability to emulate underlying hardware for each of its guest machines.

What are the two types of virtualization offered by Linux Amazon Machine Images?

Linux Amazon Machine Images use one of two types of virtualization: paravirtual (PV) or hardware virtual machine (HVM).


1 Answers

"InstanceType" attribute is missing in Properties section of Resources. Therefore, It might be taking default instance type(m1.small) that does not support 'HVM' virtualization type. I faced the similar issue, fixed it by adding Instance Type attribute. Also,'t2.micro' instance type does not support instance-store root device. Please refer to sample snippet below for reference:


"Parameters":{
    "ServerKeyName":{
        "Description" :"key pair to connect to  Server",
        "Type": "AWS::EC2::KeyPair::KeyName"
    },
    "InstanceType" : {
        "Description" : "Type of EC2 instance to launch",
        "Type" : "String",
        "Default" : "t2.micro"
    },
    ....
    ....
}
....
....
"Properties" : {
    "KeyName" : { "Ref" : "ServerKeyName" },

    "Tags" : [
    {
        "Key" : "Name",
        "Value" : "test Server"
    }],

    "ImageId" : { "Ref" : "InstanceAMI" },
    "InstanceType" : { "Ref" : "InstanceType"},
    ....
    ....
    ....
}
like image 141
Randhir Kumar Avatar answered Nov 13 '22 09:11

Randhir Kumar