admin管理员组文章数量:1516870
I have EC2 instance with template on cloudformation on AWS and if anything fails or instance is terminated my template created new instance with latest EBS backup. But this attached voleme to newly created instance is not online on the server(windows). I tried 2 different userdata scripts for setting mz volume online and none of this works. Can anyone help me where i'm doing misstake:
This is my old code
$secondDisk = (Get-Disk | Select-Object -Skip 1 -First 1).DiskNumber
Set-Disk -Number $secondDisk -IsOffline $false
sleep 5
Set-Disk -InputObject $(Get-Disk -Number 1) -IsReadOnly $false
echo "Volume - $volumeId back ONLINE."
This is my new code
$secondDisk = (Get-Disk | Select-Object -Skip 1 -First 1).DiskNumber
Set-Disk -Number $secondDisk -IsOffline $false
echo "Disk $secondDisk is now online."
Set-Disk -InputObject (Get-Disk -Number $secondDisk) -IsReadOnly $false
echo "Disk $secondDisk is no longer ReadOnly."
echo "Disk $secondDisk is now ready to be used with existing data."
Thanks for advice
本文标签:
版权声明:本文标题:amazon ec2 - AWS, EC2 Instance, Windows, Userdata not able to set disk online with script - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.betaflare.com/web/1742363545a2460832.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论