AWS command line tasks - Create 500 GB EBS Volume, to attach and detach the volume

To create a volume of 500 GB 
aws ec2 --region us-east-1 create-volume --size 500 --availability-zone us-east-1d --volume-type gp2

size : in GB
availability zone : This needs to be in the same availability zone as that of the instance that we are going to attach the EBS volume.

To attach an EBS volume to the ec2 instance.

aws  ec2 attach-volume --volume-id vol-9dfjhsdkfj93 --instance-id i-1234567899oasd  --device /dev/xvdb --region us-east-1

After attaching format the drive and mount it like what we do for a normal hard disk drive.

To detach an EBS volume from the ec2 instance.

aws ec2 detach-volume --volume-id vol-9dfjhsdkfj93 --region us-east-1


Comments

Popular posts from this blog

Logical volume vmxxxx_img is used by another device - Error on LVM removal

Open VZ cheat Sheet

Cheat sheet for Hardware RAID health check - Megaraid, Adaptec, 3wareraid and HPraid.