gpt4 book ai didi

amazon-ec2 - AWS::EC2::实例拒绝启动。以 root 身份安装错误的驱动器?

转载 作者:行者123 更新时间:2023-12-03 07:46:18 24 4
gpt4 key购买 nike

我正在尝试配置一些需要多个 EBS 驱动器的 EC2 实例。我正在尝试通过 BlockDeviceMappings 定义根卷和其他 4 个卷。

问题:据我所知,下面的代码符合我在网上看到的任何示例。但当 Windows 启动时,它会立即死机。查看 EC2 控制台 ( screenshot ),我可以看到该实例附加了 7 个 EBS 卷(而不是 5 个),并且/dev/xda 设置为 root 而不是/dev/sda1。

  "Mappings" : {
"AWSRegionToAMI" : {
"us-east-1" : { "Windows2012R2" : "ami-5d1b984a" },
"us-west-1" : { "Windows2012R2" : "ami-07713767" },
"us-west-2" : { "Windows2012R2" : "ami-241bd844" }
},
"VolumeSize" : {
"DataDrive" : { "Size" : "50" },
"LogDrive" : { "Size" : "50" },
"TempDrive" : { "Size" : "400" },
"BackupDrive" : { "Size" : "100" }
},
"stackmap" : {
"sqlha" : {
"Name": "MS SQL Server 2014 Always On",
"chefjson" : "https://s3.amazonaws.com/[redacted]",
"os" : "win",
"bootstrapurl" : "https://s3.amazonaws.com/[redacted]"
}
}
},

"WSFCNode1": {
"Type": "AWS::EC2::Instance",
"Properties": {
"ImageId" : { "Fn::FindInMap" : [ "AWSRegionToAMI", { "Ref" : "AWS::Region" }, "Windows2012R2" ] },
"InstanceType": { "Ref": "InstanceType" },
"EbsOptimized": "true",
"NetworkInterfaces": [
{
"DeleteOnTermination": "true",
"DeviceIndex": 0,
"SubnetId": { "Ref": "PrivateSubnet1ID" },
"SecondaryPrivateIpAddressCount": 2,
"GroupSet": [
{ "Ref": "WSFCSecurityGroup" },
{ "Ref": "WSFCClientSecurityGroup" }
]
}
],
"BlockDeviceMappings": [
{
"DeviceName": "/dev/sda1",
"Ebs" : {"VolumeSize": "60"}
},
{
"DeviceName": "/dev/xvdb",
"Ebs" : {"VolumeSize": { "Fn::FindInMap" : [ "VolumeSize", "DataDrive", "Size" ]} }
},
{
"DeviceName": "/dev/xvdc",
"Ebs" : {"VolumeSize": { "Fn::FindInMap" : [ "VolumeSize", "LogDrive", "Size" ]} }
},
{
"DeviceName": "/dev/xvdd",
"Ebs" : {"VolumeSize": { "Fn::FindInMap" : [ "VolumeSize", "TempDrive", "Size" ]} }
},
{
"DeviceName": "/dev/xvde",
"Ebs" : {"VolumeSize": { "Fn::FindInMap" : [ "VolumeSize", "BackupDrive", "Size" ]} }
}
],
"KeyName": { "Ref": "KeyPairName" },
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [
"<powershell>\n",

"# Disable UAC and allow scripts to run\n",
"New-ItemProperty -Path HKLM:Software\\Microsoft\\Windows\\CurrentVersion\\policies\\system -Name EnableLUA -PropertyType DWord -Value 0 -Force\n",
"Set-ExecutionPolicy Unrestricted -force\n",
"c:\\windows\\System32\\WindowsPowershell\\v1.0\\powershell.exe -noninteractive -noprofile Set-ExecutionPolicy unrestricted -force\n",
"c:\\windows\\syswow64\\windowspowershell\\v1.0\\powershell.exe -noninteractive -noprofile Set-ExecutionPolicy unrestricted -force\n",

"#Change TimeZone\n",
"tzutil /s ", {"Ref" : "Timezone"}, "\n",

"#Run Bootstrap PS1\n",
"$newname = '", { "Fn::Join" : ["", [{"Ref" : "Environment"}, {"Ref" : "Location"}, {"Ref" : "Stack"}, {"Ref" : "Role"} ]]},"'\n",
"$region = '", {"Ref" : "VPCRegion"}, "'\n",
"$role = '", {"Ref" : "Role"}, "'\n",
"$chef_rb = '", { "Fn::FindInMap" : [ "stackmap", { "Ref" : "Role" }, "chefjson"]}, "'\n",
"mkdir 'c:\\temp' -force\n",
"(new-object System.Net.WebClient).DownloadFile( 'https://s3.amazonaws.com/[redacted]', 'c:\\temp\\bootstrap.ps1')\n",
"powershell c:\\temp\\bootstrap.ps1 -newname $newname -region $region -role $role -chef_rb $chef_rb -logfile c:\\temp\\bootstrap.log -verbose true\n",

"#Reboot if needed\n",
"Start-Sleep -s 10\n",
"Restart-Computer\n",
"mkdir 'c:\\temp\\cf_reboot_cmd_ran' -force\n",
"shutdown -r\n",
"mkdir 'c:\\temp\\cf_shut_cmd_ran' -force\n",
"Start-Sleep -s 10\n",
"mkdir 'c:\\temp\\cf_ran_again' -force\n",

"</powershell>"
] ] }
},
"Tags": [
{ "Key": "Name", "Value": "SQL Node 1" }
]
}
},

令人困惑的是,即使我删除所有额外的驱动器并只对一个磁盘进行 block 设备映射

    "BlockDeviceMappings": [
{
"DeviceName": "/dev/sda1",
"Ebs" : {"VolumeSize": "60"}
}
],

...我最终还是得到了三卷,并且错误地将一卷 (/dev/xda) 指定为 root。 Screenshot

这是 Windows 的事情吗?我的 block 设备映射需要是什么样子才能正确安装为 root(或 C:,在本例中)?

最佳答案

没关系。根本问题出在我选择的 AMI 中。一旦我选择了合适的 Windows AMI,一切就完美了。

对于遇到此问题的其他人,请仔细检查您的 AMI 选择。

关于amazon-ec2 - AWS::EC2::实例拒绝启动。以 root 身份安装错误的驱动器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39620992/

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