Skip to content

Instantly share code, notes, and snippets.

@drewblas
Created April 15, 2013 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drewblas/5390358 to your computer and use it in GitHub Desktop.
Save drewblas/5390358 to your computer and use it in GitHub Desktop.
Launch an instance with a specific root disk size instead of the default
# Launch an instance with a specific root disk size instead of the default
UBUNTU_EBS_IMAGE=ami-d0f89fb9
# New volume size in GB
VOLUME_SIZE=30
SNAPSHOT_ID=`ec2-describe-images $UBUNTU_EBS_IMAGE | egrep "^BLOCKDEVICEMAPPING" | cut -f4`
ec2-run-instances $UBUNTU_EBS_IMAGE \ # Don't forget all your other normal parameters
--block-device-mapping "/dev/sda1=$SNAPSHOT_ID:$VOLUME_SIZE:true:standard"
# Ubuntu images on boot will auto-resize their root disk to match the available EBS size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment