When you create an instance on AWS, you will see that there are multiple options to attach storage to your device. Let’s discuss and compare the difference between EFS and EBS types of storage.
EBS (Elastic Block Storage)
- EBS volumes can be attached to only 1 instance.
- It can be attached to the instance in the same AZ only. For example, if you create an instance in ap-south1, an EBS volume created in the same region can only be attached to that instance.
- You can detach an EBS volume and attach it to another instance in the same AZ but you can’t move across a different AZ.
- If you want to move your EBS volume to a different AZ, then you will need to take a snapshot of the volume and restore it in the other zone (Tedious Task and instance need to be stopped)
- Root EBS volumes of instances get terminated by default when you delete the instance, although you can change this behavior while creating an instance.
EFS (Elastic File Storage)
- You can mount EFS to many instances across AZ at the same time.
- You can use it to share the website files across multiple instances.
- EFS is costly
- It can be only used for Linux servers.
EFS can be mounted on multiple instances at the same time, so if you create a file on 1 instance you can access it from another instance as well. While EBS you can only mount it to 1 instance in the same AZ.
How to decide what to use?
If you have an application where different types of instances are using the same file, then you need to use EFS.
If your application is running on single instances, and it doesn’t have any files to share, then you should use EBS which will save you some money.
I hope I was able to explain the difference between EFS and EBS. I have been posting here all the stuff which you will use in the digital era like the Linux system and much more. You can always contact us if you have any questions