DEV Community

loading...
This is Learning

Configuring EC2 storage (EBS) Hands On

Ajit Singh
Angular Collborator | Frontend Developer | Currently learning AWS
Updated on ・4 min read

We will do a hands on EBS volumes so that we can understand how to attach an EBs volume to an EC2 instance.

  • Start creating an EC2 instance

  • In step 4 Add Storage we can see there are many options regarding storage.

  1. Size of storage - Here we define how much storage we want attaches to our EC2 instance like our EC2 instance may contain node modules, python packages etc according to our needs

  2. Type - Here we define what type of a storage we want do we want a more durable or the one which is focused on IOPS etc. You can learn more about it from the documentation

  3. IOPS - How many input output operations we want per second

  4. Delete on termination - Check this checkbox if we want to delete EBS volume on termination

  5. Encryption - If we generate a key we can encrypt our data using that AWS key.

EBS storage

  • Now we can create our instance with the selected storage

  • You can check the details of the of our EBS storage in the storage tab once we select an EC2 instance

EBS storage tab

Create a new EBS storage

We can also create an independent storage which we can later join to our EC2 instance

  • To create a new EBS storage go to our EC2 dashboard and select volumes under elastic block store. You will see that there is our already created EBS volume. To create a new volume click on create volume

Ebs storage 1

  • You will see the same options that we saw earlier while creating our EC2 instance.Remember to create the volume in the same availability zone as in the EC2 instance.

Ebs storage 2

  • We get a status successful page and voila we created a new volume for our EC2 instance Ebs storage 3

Attach an EBS volume to an EC2 instance

  • To attach an EBS volume to an EC2 instance right click on your EBS volume and click attach volume

Attach volume 1

  • You will see a dialog from where you can attach your EBS volume to an instance

Attach volume 2

  • Right now we have attached an EBS volume to our EC2 instance but we will need to format it with a file system to use it with our EC2 instance like any other storage. Which is a bit complex and out of scope for this tutorial but you can check that out in the documentation
    Attach volume 3

  • If you terminate your instance then the one on which we selected delete on termination will be deleted

terminate 1
Terminate 2
terminate 3

Use snapshots to move EBS volumes

We can only work with our EBS volumes in one availability zone bout how to move them across availability zones. To do that we can use snapshots

  • To create a snapshot go to the volumes in EC2 dashboard under Elastic Block Store

Snapshot

  • Select the volume and on the top click on actions. You will see an option for create snapshot
    Snaphot 1

  • Click create snapshot after that you will see the screen below and put a description for our snapshot. Click on create snapshot. Your snapshot is created.
    snapshot2
    snapshot 3

  • It will take some time to create a snapshot but after sometime you can see the snapshot under snapshots under Elastic Block Store
    creaed snapshot

  • Once you are in these select the snapshot and from actions you can select copy.
    copy

  • Now you can see options to copy it across regions. If you want to copy it in any other region you can do it here.
    copy region

  • Now we can go across regions but still cannot copy across availability zones. To create a volume across Availability zone select snapshot -> click actions -> select create volume -> now you can create a volume with the data from the selected snapshot.
    copy az

  • Here we get the option to change Availability zone or change disk size. Same way you can create a new volume using snapshots across regions.
    copy az 2

copy az result

Cleanup

Delete all the volumes and EC2 instances they may cost you money

Wow we learnt a lot of things today this may seem trivial once you are done with it but think of it in terms of physical servers how how will it take to move your servers disk space from one region into another. How long will it take to change capacity. Isn't it just wonderful how easy cloud made software operations. Next series amazon devices joined to physical drives EFS for a better throughput that network devices.

Discussion (0)