【问题标题】:Cloudformation template gives " Non-Windows instances with a virtualization type of 'hvm' are currently not supported for this instance typeCloudformation 模板给出“此实例类型当前不支持虚拟化类型为 'hvm' 的非 Windows 实例
【发布时间】:2017-12-02 04:35:39
【问题描述】:

我写了一个简单的 cloudformation 模板,应该在 AWS 上创建一个 EC2 实例。

Cloudformation 模板提供“此实例类型当前不支持虚拟化类型为 'hvm' 的非 Windows 实例。”我在这个论坛上查找,他们说“InstanceType”丢失了。我是云阵的新手。我应该把“InstanceTyp”放在哪里?非常感谢 { "AWSTemplateFormatVersion" : "2010-09-09",

       "Description" : "AWS CloudFormation Sample Template EC2InstanceSample: Create an Amazon EC2 instance running the Amazon Linux AMI. The AMI is chosen based on the region in which the stack is run. This example uses the default security group, so to SSH to the new instance using the KeyPair you enter, you will need to have port 22 open in your default security group. **WARNING** This template an Amazon EC2 instances. You will be billed for the AWS resources used if you create a stack from this template.",

   "Parameters" : {
       "KeyName": {
        "Description" : "Name of an existing EC2 KeyPair ",
         "Type": "String",
         "MinLength": "1",
         "MaxLength": "255",
         "AllowedPattern" : "[\\x20-\\x7E]*",
         "ConstraintDescription" : "can contain only ASCII characters."
      }
    },

     "Mappings" : {
     "RegionMap" : {
            "us-east-1"      : { "AMI" : "ami-6df1e514" },
            "us-west-1"      : { "AMI" : "ami-6df1e514" },
            "us-west-2"      : { "AMI" : "ami-6df1e514" },
             "eu-west-1"      : { "AMI" : "ami-6df1e514" },
            "sa-east-1"      : { "AMI" : "ami-3e3be423" },
            "ap-southeast-1" : { "AMI" : "ami-74dda626" },
             "ap-southeast-2" : { "AMI" : "ami-b3990e89" },
             "ap-northeast-1" : { "AMI" : "ami-dcfa4edd" }
            }
           },

      "Resources" : {
         "Ec2Instance" : {
            "Type" : "AWS::EC2::Instance",
            "Properties" : {
            "KeyName" : { "Ref" : "KeyName" },
            "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" :    "AWS::Region" }, "AMI" ]},
           "UserData" : { "Fn::Base64" : "80" }
       }
      }
    },

     "Outputs" : {
"InstanceId" : {
  "Description" : "InstanceId of the newly created EC2 instance",
  "Value" : { "Ref" : "Ec2Instance" }
},
"AZ" : {
  "Description" : "Availability Zone of the newly created EC2 instance",
  "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "AvailabilityZone" ] }
},
"PublicIP" : {
  "Description" : "Public IP address of the newly created EC2 instance",
  "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PublicIp" ] }
},
"PrivateIP" : {
  "Description" : "Private IP address of the newly created EC2 instance",
  "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PrivateIp" ] }
},
"PublicDNS" : {
  "Description" : "Public DNSName of the newly created EC2 instance",
  "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PublicDnsName" ] }
},
"PrivateDNS" : {
  "Description" : "Private DNSName of the newly created EC2 instance",
  "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PrivateDnsName" ] }
  }
  }
 }

【问题讨论】:

  • 我在发帖前搜索了一下,发现了一个类似的问题。但我不知道如何实现答案中提到的内容。

标签: amazon-web-services amazon-ec2 amazon-cloudformation


【解决方案1】:

我看到您没有在 CF 中指定实例类型。默认类型为m3.medium。在您使用的区域中,m3.medium 似乎不支持 hvm 类型的 AMI。

一种指定实例类型的方法:EC2 Instance Type Parameter

【讨论】:

  • helloV,现在可以使用了。感谢您将我指向 EC2 实例类型参数链接。我应该发布工作代码吗?这个论坛的新手
  • 我不能接受你的回答,因为我没有足够的徽章说明
猜你喜欢
  • 2015-10-20
  • 1970-01-01
  • 2016-09-20
  • 2014-09-05
  • 2020-08-03
  • 1970-01-01
  • 1970-01-01
  • 2021-05-24
  • 2018-06-02
相关资源
最近更新 更多