DEV Community

loading...

Everything you need to know about EC2 (Part 3: EBS vs EFS)

frontendexp
Mobile and Web development
Originally published at aws.plainenglish.io on ・5 min read

In my last article, I explained what EBS is but here I will explain EFS and compare it to EBS.
EFS, provides a simple, serverless, set-and-forget, elastic file system that lets you share file data without provisioning or managing storage. EFS is built to scale on-demand to petabytes without disrupting applications.

With EFS, you have the choice of creating file systems using Standard or One Zone storage classes.
Standard storage classes store data within and across multiple availability zones (AZ).
One Zone storage classes store data redundantly within a single AZ, at a 47% lower price compared to file systems using Standard storage classes, for workloads that don’t require multi-AZ resilience.
FS offers four storage classes:
Amazon EFS Standard
Amazon EFS Standard-Infrequent Access (EFS Standard-IA)
Amazon EFS One Zone
Amazon EFS One Zone-Infrequent Access (EFS One Zone-IA)
Find more about the pricing on these: https://aws.amazon.com/efs/pricing/#Pricing_Table
Amazon EFS is well suited to support a broad spectrum of use cases from home directories to business-critical applications.
https://aws.amazon.com/efs/#Use_cases
Use cases
Containers and serverless persistent file storage
Amazon EFS enables customers to persist data and state from their containers and serverless functions, providing fully managed, elastic, highly-available, scalable, and high-performance, cloud-native shared file systems.
These same attributes are shared by Amazon Elastic Container Service (Amazon ECS), Amazon Kubernetes Service (Amazon EKS), AWS Fargate, and AWS Lambda, so developers don’t need to design for these traits, the services are simply ready for modern application development with data persistence.
Amazon EFS allows data to be persisted separately from compute and enables applications to have cross-AZ availability and durability. Amazon EFS provides a shared persistence layer that allows stateful applications to elastically scale up and down, such as for DevOps, web serving, web content systems, media processing, machine learning, analytics, search index, and stateful microservices applications.
Move to managed file systems
Amazon EFS provides the scalability, elasticity, availability, and durability to be the file store for enterprise applications and for applications delivered as a service.
Its standard file system interface, file system permissions, and directory hierarchy make it easy to migrate enterprise applications from on-premises to the AWS cloud and to build new ones. Move your business-critical, Linux-based applications to managed file systems with Amazon EFS, while lowering your total cost of ownership (TCO).
Analytics & machine learning
Amazon EFS provides the ease of use, scale, performance, and consistency needed for machine learning and big data analytics workloads. Data scientists can use EFS to create personalized environments, with home directories storing notebook files, training data, and model artifacts. Amazon SageMaker integrates with EFS for training jobs, allowing data scientists to iterate quickly.
Web serving & content management
Amazon EFS provides a durable, high throughput file system for content management systems and web serving applications that store and serve information for a range of applications like websites, online publications, and archives. Since Amazon EFS adheres to the expected file system directory structure, file naming conventions, and permissions that web developers are accustomed to, it can easily integrate with web applications.
Application testing & development
Amazon EFS provides your development environments a common storage repository that gives you the ability to share code and other files in a secure and organized way. You can provision, duplicate, scale, or archive your test, development, and production environments with a few clicks, enabling your organization to be more agile and responsive to customer needs. Amazon EFS delivers a scalable and highly available solution that is ideal for testing and development workloads.
Media & entertainment
Media workflows like video editing, studio production, broadcast processing, sound design, and rendering often depend on shared storage to manipulate large files. Amazon EFS provides a strong data consistency model with high throughput and shared file access which can cut the time it takes to perform these jobs and consolidate multiple local file repositories into a single location for all users.
Database backup
Amazon EFS presents a standard file system that can be easily mounted with NFSv4 from database servers. This provides an ideal platform to create portable database backups using native application tools or enterprise backup applications. Many businesses want to take advantage of the flexibility of storing database backups in the cloud either for temporary protection during updates or for development and test.

Discover Financial Services shifted from an open-source storage system to Amazon EFS and reduced storage costs by 50%, simplifying management, and increasing scalability.

Ancestry is a global leader in family history and consumer genomics. They moved to Amazon Web Services (AWS) for the scalability and flexibility of the cloud, it enables multiple scientists to perform genomics research, automatically scales compute and storage resources up or down, and onboards new scientists faster and easier.
So which one should you use?
EBS volumes can be attached to only one instance at a time, and they are locked into a specific Availability Zone.

So for example, we have our EC2 instance in the first AZ and the EBS volume, as we can see, really is within that AZ and is only attached to one EC2 instance at a time.

If you want to migrate an EBS volume across different Availability Zone, then you first need to take snapshots, and then, once you have the snapshots you’re going to restore the snapshot into another AZ, and that will create a new EBS volume into that AZ.
And so while you do this, EBS snapshots, EBS backups, that will use all of IO on your EBS volumes, so it should be run only when your instance is not actively using your EBS volumes otherwise, you may get performance issues.
Finally, the Root EBS Volumes of your instances will get terminated by default when your EC2 instance gets terminated, but this is a behavior that you can disable if you want it to.
So EFS can be mounted to hundreds or thousands, of instances across multiple Availability Zones.
You can use EFS Mount Targets that are going to be in a specific AZ, to mount between your EC2 instances all the way to your EFS drive.
EFS is going to be more expensive than EBS, about three times more expensive, but if you want it to do some cost-saving, you can use EFS-Infrequent Access as a storage tier and using a lifecycle policy, to have these enhanced cost savings.
For EFS, you do get billed only for what you use on your EFS, whereas for EBS, you have to provide in advance a size that you know for EBS drive, and you pay for the provisioned capacity not the actual usable capacity.
So, now you should remember, EFS is really for a network file system to be mounted across multiple instances.
EBS is for a network volume, then it should be mounted only on one instance and it is locked to an AZ.

Discussion (0)