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.

preguntada hace 2 años474 visualizaciones
1 Respuesta
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

respondido hace 2 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas