Last Updated: February 25, 2016
·
1.468K
· dhirenb

Attaching EBS volume to EC2 instance

  • Create EC2 instance
  • Create EBS volume and attach it to EC2 instance
  • Ssh into EC2 instance. eg: ssh -i ~/.ssh/id_rsa ubuntu@public-dns-address
  • Format EBS volume: sudo mkfs -t ext4 /dev/sdf
  • Add a line to the /etc/fstab file on EC2 instance: /dev/sdf /vol ext4 defaults,noatime 1 1
  • sudo mkdir /vol to create vol directory.
  • sudo mount /dev/sdf to mount the EBS volume.

2 Responses
Add your response

Thanks.

over 1 year ago ·

It's good to add nobootwait to EBS volumes in fstab to make sure it doesn't hold up your instance in the boot process if it is detached in the future.

over 1 year ago ·