此实例类型当前不支持虚拟化类型为"hvm"的非Windows实例:[AWS Cloudformation]

Sub*_*thi 14 amazon-ec2 amazon-web-services aws-cloudformation

我正在尝试用amazon linux创建一个t2.micro ec2实例作为os使用cloudformation.以下是json文件(重要的部分).

    "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" }
      }
    },
Run Code Online (Sandbox Code Playgroud)

当我运行此文件时,我得到以下错误

Non-Windows instances with a virtualization type of 'hvm' are currently not supported for this instance type
Run Code Online (Sandbox Code Playgroud)

我猜这个错误来自于我们使用t1族实例类型,但我使用的是t2.micro.请解释一下为什么会这样?

ran*_*rkr 21

" 资源"的"属性"部分中缺少" InstanceType "属性.因此,它可能采用不支持" HVM "虚拟化类型的默认实例类型(m1.small).我遇到了类似的问题,通过添加Instance Type属性修复了它.此外,' t2.micro '实例类型不支持实例存储根设备.请参阅下面的示例代码段以供参考:


"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"},
    ....
    ....
    ....
}
Run Code Online (Sandbox Code Playgroud)