gpt4 book ai didi

amazon-web-services - 此实例类型 : [AWS Cloudformation] 目前不支持虚拟化类型为 'hvm' 的非 Windows 实例

转载 作者:行者123 更新时间:2023-12-03 21:37:25 25 4
gpt4 key购买 nike

我正在尝试使用 cloudformation 创建一个 t2.micro ec2 实例,其中 amazon linux 作为操作系统。以下是 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" }
}
},

当我运行此文件时,出现以下错误

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

我猜当我们使用 t1 系列实例类型但我使用 t2.micro 时会出现此错误。请解释一下为什么会这样?

最佳答案

资源的“属性”部分中缺少“InstanceType”属性。因此,它可能采用不支持“HVM”虚拟化类型的默认实例类型(m1.small)。我遇到了类似的问题,通过添加实例类型属性来修复它。此外,“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"},
....
....
....
}

关于amazon-web-services - 此实例类型 : [AWS Cloudformation] 目前不支持虚拟化类型为 'hvm' 的非 Windows 实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31708339/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com