Amazon EBS Volumes:
An Amazon EBS volume is a durable, block-level storage device that you can attach to a single EC2 instance. It is a virtual hard disk drive.
EBS volume can be attached during instance launch as well as after instance launch. Learn it both the ways:
1. Attaching EBS volume while launching an EC2 instance
- While creating your instance attach EBS volume in the following step:
Step 4 : Storage
Add storage to the instance, you can increase or decrease the size, choose volume types such as SSD (gp2), SSD (io1) or Magnetic.
Attach EBS volume to the instance.
For example : EBS volume – General Purpose SSD(gp2).
- Follow rest of the steps as you did before and launch the instance.
- When the Instance state is running, click Volumes under ELASTIC BLOCK STORE section.
- Two different volumes are attached to the instance.
- EBS volume type can be changed or increased even after instance is launched.
2. Attaching EBS volume after Instance is launched:
- Click Volumes under Elastic Block Store section, click Create Volume.
- Volume page appears with default settings, You can customize it as per your requirements.
For example :
- Volume type: Magnetic (standard)
- Size (GiB) : 50
- Availability Zone : eu-central-1b (Choose same availability zone on which your instance was launched.)
- You can select a Snapshot ID, add Encryption and add tags or skip these fields. Then create Volume.
- Volume has been created , close it and proceed to next step.
- New volume appears in the list of volumes , check the state of the volume , it shows available where as the other volume shows its in-use .
- To make new volume in-use choose Actions and then Attach Volumes.
- A box will pop up select your Instance and then chooseAttach.
- Both the volumes appears in-use, now get back to the instance.
- Select the instance and read the description given below the instance. It shows Root device and Block device. Root device is the system device which contains boot volume where as Block device is Amazon EBS volume attached to the instance.
Deleting an Amazon EBS Volume
To delete a Volume it should be de-attached from instance and should be in available state.
Following are the steps to Delete Amazon EBS Volume :
- Select Volumes under Elastic Block store section. Then select volume you wish to delete.
- Select Actions, choose Detach Volume and then confirm to detach.
- The state of the new Volume changes to Available , again you can attach it to other or same instance but for now delete it .
- Select the Volume, choose Actions , Delete Volume and then Confirm.
- Volume has been deleted successfully, now only system device volume can be seen.