Skip to content

Instantly share code, notes, and snippets.

@gregtaylor99
Forked from pahud/self_vol_attach.sh
Created March 23, 2018 01:37
Show Gist options
  • Save gregtaylor99/c83ea7d946e18a26851883e619e778cc to your computer and use it in GitHub Desktop.
Save gregtaylor99/c83ea7d946e18a26851883e619e778cc 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