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
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
- 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
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
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.
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.