aws ec2 run-instances with offline and unallocated disks

0

Hi Community
We have created a new ec2 instance with 3 drives by aws ec2 run-instances as below. The 3 volumes have been created and were shown as attached in the aws console ec2 volumes screen. Nevertheless on the server in Disk Management, only Drive C: was available, the additional 2 drives were offline and unallocated: Enter image description here We needed to take them online, initialize and allocate by Windows tools. Does anybody know how we make them online and allocated by an aws bash command? Thanks! Patrick


aws ec2 run-instances
--instance-type t2.xlarge
--image-id ami-0c6e3ed6b1dd28a39
--block-device-mappings file:///home/cloudshell-user/mapping.json
--key-name xxx
--security-group-ids xxx
--subnet-id xxx
--instance-initiated-shutdown-behavior stop
--disable-api-termination
mapping.json:
[
{
"DeviceName": "/dev/sda1",
"Ebs": {
"DeleteOnTermination": true,
"VolumeSize": 70,
"VolumeType": "gp2"
}
},
{
"DeviceName": "/dev/sdh",
"Ebs": {
"DeleteOnTermination": true,
"VolumeSize": 80,
"VolumeType": "gp2"
}
},
{
"DeviceName": "/dev/sdi",
"Ebs": {
"DeleteOnTermination": true,
"VolumeSize": 80,
"VolumeType": "gp2"
}
}
]

  • In order to accomplish this, you will have to provide user data with the powershell commands to mount and format the disks and then allocate them to drives as you wish. I am not well versed in powershell to provide the commands.

已提問 2 年前檢視次數 469 次
1 個回答
0

Hi Rodney

Thanks for your comment. Do you mean I should use the '--user-data'-parameter in 'aws ec2 run-intances' to start a powershell script to mount and attach drives?

Thanks! Patrick

已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南