Skip to content

Instantly share code, notes, and snippets.

@pahud
Last active March 23, 2018 01:37
Show Gist options
  • Save pahud/44b45637f75c5d44d7a0 to your computer and use it in GitHub Desktop.
Save pahud/44b45637f75c5d44d7a0 to your computer and use it in GitHub Desktop.
self volume attaching within EC2
instId=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)
deviceName='/dev/sdz'
volId='vol-97f21469'
region='ap-northeast-1'
mountPoint='/o'
aws --region $region ec2 attach-volume --device $deviceName --volume-id $volId --instance-id $instId && \
mount $deviceNmae $mountPoint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment