This content originally appeared on DEV Community and was authored by Ajit Singh
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.
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
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
IOPS - How many input output operations we want per second
Delete on termination - Check this checkbox if we want to delete EBS volume on termination
Encryption - If we generate a key we can encrypt our data using that AWS key.
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
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
- 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.
- We get a status successful page and voila we created a new volume for our EC2 instance
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
- You will see a dialog from where you can attach your EBS volume to an instance
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
If you terminate your instance then the one on which we selected delete on termination will be deleted
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
Select the volume and on the top click on actions. You will see an option for create snapshot
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.
It will take some time to create a snapshot but after sometime you can see the snapshot under snapshots under Elastic Block Store
Once you are in these select the snapshot and from actions you can select 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.
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.
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.
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.
This content originally appeared on DEV Community and was authored by Ajit Singh
Ajit Singh | Sciencx (2021-06-24T05:19:24+00:00) Configuring EC2 storage (EBS) Hands On. Retrieved from https://www.scien.cx/2021/06/24/configuring-ec2-storage-ebs-hands-on/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.