Getting error while starting ec2 instance after attaching volume: I have defined device_name as "/dev/sda1" but it still picking up "/dev/sdf".
Here is my code:
ec2_vol:
instance: "{{ instance_id }}"
id: "{{ ec2_vol.volume_id }}"
device_name: "/dev/sda1"
region: "{{ aws_region }}"
You can also use aws cli:
aws ec2 attach-volume --volume-id vol-abcde12345678901e --instance-id i-acdef123456789012 --device /dev/sda1
https://docs.aws.amazon.com/cli/latest/reference/ec2/attach-volume.html#examples
It seems like this works differently for literally everyone, so let me add my 2 cents and describe what worked for me.
I had attached my root volume as (literally) sda1
because that is the format described on the "attach volume" page, however, as the error message above suggests, it is looking for a device name that is literally /dev/sda1
.
Detaching and re-attaching my root volume as /dev/sda1
(vs. sda1
or xvda
as described in the example) solved my problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With