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
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
Post a Comment