‫Now, here's a third type of storage
‫you can attach onto an EC2 instance.
‫And this is a network file system or NFS.
‫So, EFS stands for elastic file system
‫and it is a managed network file system.
‫And the idea and the benefits of it
‫is that it can be mounted to hundreds
‫of EC2 instances at a time.
‫So, before we had an EBS volume attached
‫to only one EC2 instance at a time.
‫But with an EFS drive, you can mount it
‫onto hundreds of EC2 instances.
‫So, that makes it a shared network file system
‫or shared NFS.
‫So, EFS works only with your Linux EC2 instances.
‫And on top of it, it works
‫across multiple availability zones.
‫So, it is possible for an instance
‫in one AZ to be attaching the same EFS volume
‫as the instance in another AZ.
‫Now, EFS is highly available, scalable, pretty expensive.
‫It's about three times the price of a gp2 EBS volume,
‫but you pay per use and you don't plan for capacity.
‫So, that means that if you store 20 gigabytes of data
‫onto your EFS drive then you're only going to pay
‫for these 20 gigabytes.
‫So, if you look at the diagram, this is very easy.
‫We have an EFS file system with a security group,
‫and then we have EC2 instances
‫in various availability zones connected to it.
‫So, we have EC2 instances in us-east-1a,
‫EC2 instances in us-east-1b,
‫as well as EC2 instances in us-east-1c.
‫And they're all connected to the same EFS File system.
‫So now, let's outline the exact differences
‫between EBS and EFS.
‫So, with EBS, say we had EC2 instance
‫in one AZ and another one.
‫Then the EBS volume can only be attached
‫to one instance in one specific AZ.
‫And the EBS volumes are bound
‫to specific availability zones.
‫But if we wanted to move over the EBS volume
‫from one AZ to another, we could create a snapshot,
‫it would create an EBS snapshot
‫and then restore that snapshot into a new availability zone.
‫And effectively we would've moved the EBS volume over.
‫But this is a copy, this is not an in-sync replica.
‫This is a copy, and that would mean
‫that this drive can now be used by another EC2 instance.
‫EFS is a network file system.
‫That means that whatever is on the EFS drive
‫is shared by everything that is mounted to it.
‫So, what does that mean?
‫Say we have many instances in Availability Zone 1 on one
‫or many instances as well on Availability Zone 2.
‫At the same time, all these instances
‫can mount the same EFS drive, okay,
‫using a mount target, and they will all see the same files.
‫So, that makes it a shared file system.
‫So, hopefully that makes it a very easy way
‫to understand the difference between EBS and EFS.
‫And this is something that the exam will test you on.
‫There is a storage class you need to know for EFS
‫and it's called EFS infrequent access or EFS-IA.
‫So, storage class is going to be cost-optimized
‫for files that you don't access very often.
‫So, for example, you don't access these files every day.
‫And this storage class will give you
‫upto 92% lower cost for storing the data
‫compared to the other surge class,
‫which is called EFS standard.
‫And if you enable EFS-IA, then EFS
‫will automatically move your files to EFS-IA,
‫based on the last times they were accessed
‫and something called a lifecycle policy.
‫So, let's take an example.
‫We have our EFS file system.
‫We have three files in EFS standard
‫and maybe a fourth file in EFS standard.
‫This one hasn't been accessed for 60 days,
‫that means that no one has read this file.
‫And no one has been writing to this file either, right?
‫So, if you define your lifecycle policy
‫and you enable EFS-IA, then for example, you can say,
‫hey, after 60 days, please move this file
‫to a different storage class which is called EFS-IA,
‫which is going to have some cost saving.
‫And this is going to be done automatically.
‫Now, next time you access this file,
‫it's going to be be put back into EFS standard
‫because it's more accessed more often, right?
‫So, the idea is that this is a cost saving optimization.
‫And from an application perspective,
‫there is really no drawbacks.
‫It's very transparent to the applications,
‫that means that your applications don't even need
‫to know where the file is if it's an EFS standard,
‫or EFS-IA, it will access all these files the same way.
‫It's just behind the scenes,
‫EFS will do some cost optimizations.
‫So, something to need to know, going to your exam.
‫I hope you liked it and I will see you in the next lecture.