1 00:00:00,090 --> 00:00:02,100 ‫Now, here's a third type of storage 2 00:00:02,100 --> 00:00:04,290 ‫you can attach onto an EC2 instance. 3 00:00:04,290 --> 00:00:07,990 ‫And this is a network file system or NFS. 4 00:00:07,990 --> 00:00:10,260 ‫So, EFS stands for elastic file system 5 00:00:10,260 --> 00:00:12,520 ‫and it is a managed network file system. 6 00:00:12,520 --> 00:00:14,970 ‫And the idea and the benefits of it 7 00:00:14,970 --> 00:00:17,630 ‫is that it can be mounted to hundreds 8 00:00:17,630 --> 00:00:19,970 ‫of EC2 instances at a time. 9 00:00:19,970 --> 00:00:22,010 ‫So, before we had an EBS volume attached 10 00:00:22,010 --> 00:00:24,270 ‫to only one EC2 instance at a time. 11 00:00:24,270 --> 00:00:27,440 ‫But with an EFS drive, you can mount it 12 00:00:27,440 --> 00:00:29,720 ‫onto hundreds of EC2 instances. 13 00:00:29,720 --> 00:00:32,340 ‫So, that makes it a shared network file system 14 00:00:32,340 --> 00:00:34,090 ‫or shared NFS. 15 00:00:34,090 --> 00:00:38,820 ‫So, EFS works only with your Linux EC2 instances. 16 00:00:38,820 --> 00:00:40,600 ‫And on top of it, it works 17 00:00:40,600 --> 00:00:42,960 ‫across multiple availability zones. 18 00:00:42,960 --> 00:00:44,640 ‫So, it is possible for an instance 19 00:00:44,640 --> 00:00:48,730 ‫in one AZ to be attaching the same EFS volume 20 00:00:48,730 --> 00:00:51,230 ‫as the instance in another AZ. 21 00:00:51,230 --> 00:00:54,390 ‫Now, EFS is highly available, scalable, pretty expensive. 22 00:00:54,390 --> 00:00:57,980 ‫It's about three times the price of a gp2 EBS volume, 23 00:00:57,980 --> 00:01:00,350 ‫but you pay per use and you don't plan for capacity. 24 00:01:00,350 --> 00:01:02,900 ‫So, that means that if you store 20 gigabytes of data 25 00:01:02,900 --> 00:01:05,720 ‫onto your EFS drive then you're only going to pay 26 00:01:05,720 --> 00:01:07,063 ‫for these 20 gigabytes. 27 00:01:08,210 --> 00:01:10,610 ‫So, if you look at the diagram, this is very easy. 28 00:01:10,610 --> 00:01:13,340 ‫We have an EFS file system with a security group, 29 00:01:13,340 --> 00:01:15,130 ‫and then we have EC2 instances 30 00:01:15,130 --> 00:01:17,830 ‫in various availability zones connected to it. 31 00:01:17,830 --> 00:01:20,550 ‫So, we have EC2 instances in us-east-1a, 32 00:01:20,550 --> 00:01:22,260 ‫EC2 instances in us-east-1b, 33 00:01:22,260 --> 00:01:25,150 ‫as well as EC2 instances in us-east-1c. 34 00:01:25,150 --> 00:01:28,680 ‫And they're all connected to the same EFS File system. 35 00:01:28,680 --> 00:01:31,160 ‫So now, let's outline the exact differences 36 00:01:31,160 --> 00:01:32,980 ‫between EBS and EFS. 37 00:01:32,980 --> 00:01:35,650 ‫So, with EBS, say we had EC2 instance 38 00:01:35,650 --> 00:01:37,600 ‫in one AZ and another one. 39 00:01:37,600 --> 00:01:39,610 ‫Then the EBS volume can only be attached 40 00:01:39,610 --> 00:01:42,330 ‫to one instance in one specific AZ. 41 00:01:42,330 --> 00:01:44,050 ‫And the EBS volumes are bound 42 00:01:44,050 --> 00:01:46,110 ‫to specific availability zones. 43 00:01:46,110 --> 00:01:48,540 ‫But if we wanted to move over the EBS volume 44 00:01:48,540 --> 00:01:51,780 ‫from one AZ to another, we could create a snapshot, 45 00:01:51,780 --> 00:01:53,440 ‫it would create an EBS snapshot 46 00:01:53,440 --> 00:01:57,070 ‫and then restore that snapshot into a new availability zone. 47 00:01:57,070 --> 00:02:00,920 ‫And effectively we would've moved the EBS volume over. 48 00:02:00,920 --> 00:02:03,670 ‫But this is a copy, this is not an in-sync replica. 49 00:02:03,670 --> 00:02:05,330 ‫This is a copy, and that would mean 50 00:02:05,330 --> 00:02:08,650 ‫that this drive can now be used by another EC2 instance. 51 00:02:08,650 --> 00:02:11,010 ‫EFS is a network file system. 52 00:02:11,010 --> 00:02:12,920 ‫That means that whatever is on the EFS drive 53 00:02:12,920 --> 00:02:15,890 ‫is shared by everything that is mounted to it. 54 00:02:15,890 --> 00:02:16,990 ‫So, what does that mean? 55 00:02:16,990 --> 00:02:20,640 ‫Say we have many instances in Availability Zone 1 on one 56 00:02:20,640 --> 00:02:24,240 ‫or many instances as well on Availability Zone 2. 57 00:02:24,240 --> 00:02:26,870 ‫At the same time, all these instances 58 00:02:26,870 --> 00:02:29,980 ‫can mount the same EFS drive, okay, 59 00:02:29,980 --> 00:02:33,320 ‫using a mount target, and they will all see the same files. 60 00:02:33,320 --> 00:02:35,950 ‫So, that makes it a shared file system. 61 00:02:35,950 --> 00:02:38,070 ‫So, hopefully that makes it a very easy way 62 00:02:38,070 --> 00:02:40,447 ‫to understand the difference between EBS and EFS. 63 00:02:40,447 --> 00:02:42,850 ‫And this is something that the exam will test you on. 64 00:02:42,850 --> 00:02:45,620 ‫There is a storage class you need to know for EFS 65 00:02:45,620 --> 00:02:49,580 ‫and it's called EFS infrequent access or EFS-IA. 66 00:02:49,580 --> 00:02:51,900 ‫So, storage class is going to be cost-optimized 67 00:02:51,900 --> 00:02:54,080 ‫for files that you don't access very often. 68 00:02:54,080 --> 00:02:56,290 ‫So, for example, you don't access these files every day. 69 00:02:56,290 --> 00:02:58,200 ‫And this storage class will give you 70 00:02:58,200 --> 00:03:01,890 ‫upto 92% lower cost for storing the data 71 00:03:01,890 --> 00:03:03,940 ‫compared to the other surge class, 72 00:03:03,940 --> 00:03:06,160 ‫which is called EFS standard. 73 00:03:06,160 --> 00:03:09,280 ‫And if you enable EFS-IA, then EFS 74 00:03:09,280 --> 00:03:12,270 ‫will automatically move your files to EFS-IA, 75 00:03:12,270 --> 00:03:14,470 ‫based on the last times they were accessed 76 00:03:14,470 --> 00:03:16,920 ‫and something called a lifecycle policy. 77 00:03:16,920 --> 00:03:17,880 ‫So, let's take an example. 78 00:03:17,880 --> 00:03:19,470 ‫We have our EFS file system. 79 00:03:19,470 --> 00:03:21,570 ‫We have three files in EFS standard 80 00:03:21,570 --> 00:03:23,890 ‫and maybe a fourth file in EFS standard. 81 00:03:23,890 --> 00:03:26,180 ‫This one hasn't been accessed for 60 days, 82 00:03:26,180 --> 00:03:28,260 ‫that means that no one has read this file. 83 00:03:28,260 --> 00:03:31,150 ‫And no one has been writing to this file either, right? 84 00:03:31,150 --> 00:03:33,570 ‫So, if you define your lifecycle policy 85 00:03:33,570 --> 00:03:36,630 ‫and you enable EFS-IA, then for example, you can say, 86 00:03:36,630 --> 00:03:39,540 ‫hey, after 60 days, please move this file 87 00:03:39,540 --> 00:03:42,630 ‫to a different storage class which is called EFS-IA, 88 00:03:42,630 --> 00:03:44,690 ‫which is going to have some cost saving. 89 00:03:44,690 --> 00:03:46,820 ‫And this is going to be done automatically. 90 00:03:46,820 --> 00:03:48,093 ‫Now, next time you access this file, 91 00:03:48,093 --> 00:03:51,080 ‫it's going to be be put back into EFS standard 92 00:03:51,080 --> 00:03:53,790 ‫because it's more accessed more often, right? 93 00:03:53,790 --> 00:03:58,300 ‫So, the idea is that this is a cost saving optimization. 94 00:03:58,300 --> 00:04:00,420 ‫And from an application perspective, 95 00:04:00,420 --> 00:04:03,450 ‫there is really no drawbacks. 96 00:04:03,450 --> 00:04:05,480 ‫It's very transparent to the applications, 97 00:04:05,480 --> 00:04:06,560 ‫that means that your applications don't even need 98 00:04:06,560 --> 00:04:09,797 ‫to know where the file is if it's an EFS standard, 99 00:04:09,797 --> 00:04:12,580 ‫or EFS-IA, it will access all these files the same way. 100 00:04:12,580 --> 00:04:13,740 ‫It's just behind the scenes, 101 00:04:13,740 --> 00:04:15,890 ‫EFS will do some cost optimizations. 102 00:04:15,890 --> 00:04:18,260 ‫So, something to need to know, going to your exam. 103 00:04:18,260 --> 00:04:21,210 ‫I hope you liked it and I will see you in the next lecture.