Skip to content

Instantly share code, notes, and snippets.

@bashtoni
Last active June 9, 2020 04:22
Show Gist options
  • Save bashtoni/111288116ab3ff2159fdf59fb1760017 to your computer and use it in GitHub Desktop.
Save bashtoni/111288116ab3ff2159fdf59fb1760017 to your computer and use it in GitHub Desktop.
Attach multiple volumes to an EC2 Instance
count=0
for vol in vol-0123abcd vol-1023abcd vol-2013abcd ; do
device="/dev/xvd$(echo $count | tr '[0-9]' '[j-z]')"
aws ec2 attach-volume --volume-id $vol --instance-id i-123456789abc --device $device
count=$(expr $count + 1)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment