1 00:00:00,210 --> 00:00:02,880 ‫So now let's talk about File System Mounting. 2 00:00:02,880 --> 00:00:06,090 ‫So your Lambda functions can access your EFS file system 3 00:00:06,090 --> 00:00:08,160 ‫if they are running in a VPC. 4 00:00:08,160 --> 00:00:09,660 ‫To do so, we just configure Lambda 5 00:00:09,660 --> 00:00:12,300 ‫to mount the EFS file system to a local directory 6 00:00:12,300 --> 00:00:14,550 ‫during the year initialization. 7 00:00:14,550 --> 00:00:15,480 ‫For this to work, 8 00:00:15,480 --> 00:00:18,540 ‫you must leverage the EFS access points feature of EFS. 9 00:00:18,540 --> 00:00:20,940 ‫So, say you have an EFS File System 10 00:00:20,940 --> 00:00:23,280 ‫and you create an EFS Access Point. 11 00:00:23,280 --> 00:00:24,570 ‫Then if your Lambda functions 12 00:00:24,570 --> 00:00:26,580 ‫are deployed in a Private Subnet 13 00:00:26,580 --> 00:00:29,280 ‫that has private connectivity into your VPC, 14 00:00:29,280 --> 00:00:31,350 ‫then you are good to go. 15 00:00:31,350 --> 00:00:33,690 ‫The limitations of this is that 16 00:00:33,690 --> 00:00:36,780 ‫for each Lambda instance that will come up, 17 00:00:36,780 --> 00:00:38,310 ‫you will have one more connections 18 00:00:38,310 --> 00:00:39,870 ‫into your EFS file system, 19 00:00:39,870 --> 00:00:41,340 ‫so you need to make sure you don't hit 20 00:00:41,340 --> 00:00:42,990 ‫the EFS connection limits. 21 00:00:42,990 --> 00:00:46,050 ‫And also, if you have many many different Lambda functions 22 00:00:46,050 --> 00:00:48,360 ‫that just come up at a time, as a burst, 23 00:00:48,360 --> 00:00:51,600 ‫then you may also hit a connection burst limits. 24 00:00:51,600 --> 00:00:53,430 ‫So I want to take some time to just compare 25 00:00:53,430 --> 00:00:55,170 ‫the storage options for Lambda, 26 00:00:55,170 --> 00:00:57,030 ‫so you can understand which one is the best 27 00:00:57,030 --> 00:00:58,860 ‫based on the situation. 28 00:00:58,860 --> 00:01:01,320 ‫So the Ephemeral Storage of /tmp 29 00:01:01,320 --> 00:01:04,110 ‫has a max size of 10 gigabytes, which is a lot. 30 00:01:04,110 --> 00:01:05,490 ‫The persistence is Ephemeral, 31 00:01:05,490 --> 00:01:07,980 ‫that means that as soon as your Lambda function instance 32 00:01:07,980 --> 00:01:10,110 ‫is destroyed, you will lose the storage. 33 00:01:10,110 --> 00:01:13,680 ‫That's why it's called /tmp, for temporary. 34 00:01:13,680 --> 00:01:16,140 ‫The content is Dynamic, you can modify it as you wish. 35 00:01:16,140 --> 00:01:17,190 ‫It's a file system 36 00:01:17,190 --> 00:01:19,590 ‫and it supports any file system operation. 37 00:01:19,590 --> 00:01:23,100 ‫It's included for your Lambda function up to 512 megabytes 38 00:01:23,100 --> 00:01:24,180 ‫and then you pay for the extra 39 00:01:24,180 --> 00:01:27,090 ‫if you have more than 512 megabytes. 40 00:01:27,090 --> 00:01:29,250 ‫And, only your function has access to it 41 00:01:29,250 --> 00:01:32,940 ‫because it says storage based on your Lambda function. 42 00:01:32,940 --> 00:01:36,870 ‫This is the fastest level of retrieval for data 43 00:01:36,870 --> 00:01:38,070 ‫and it's not shared 44 00:01:38,070 --> 00:01:40,440 ‫across all your Lambda function Invocations. 45 00:01:40,440 --> 00:01:41,790 ‫So that should make sense. 46 00:01:41,790 --> 00:01:42,930 ‫Now, your Lambda Layers. 47 00:01:42,930 --> 00:01:45,270 ‫The max size is five layers per function, 48 00:01:45,270 --> 00:01:47,550 ‫up to 250 megabytes total 49 00:01:47,550 --> 00:01:51,930 ‫to not exceed the maximum Lambda package size. 50 00:01:51,930 --> 00:01:54,810 ‫And the persistence is durable because it is immutable, 51 00:01:54,810 --> 00:01:57,300 ‫you cannot change what goes into a Lambda Layer. 52 00:01:57,300 --> 00:01:59,550 ‫So it's of type archive, it is static, 53 00:01:59,550 --> 00:02:01,800 ‫it's included in your Lambda function pricing. 54 00:02:01,800 --> 00:02:04,110 ‫And, to get access to a layer, 55 00:02:04,110 --> 00:02:06,990 ‫you need to make sure you have the proper IAM permissions. 56 00:02:06,990 --> 00:02:09,390 ‫It also is the fastest speed 57 00:02:09,390 --> 00:02:11,160 ‫to access the data on the layer 58 00:02:11,160 --> 00:02:14,490 ‫because it is attached as storage to your Lambda function, 59 00:02:14,490 --> 00:02:17,370 ‫and it is shared across all your Invocations of Lambda, 60 00:02:17,370 --> 00:02:18,660 ‫so they all share, remember. 61 00:02:18,660 --> 00:02:22,350 ‫You cannot modify data on the Lambda Layer. 62 00:02:22,350 --> 00:02:23,940 ‫If you are using Amazon S3, 63 00:02:23,940 --> 00:02:26,160 ‫then you can go as big as you want, for size, 64 00:02:26,160 --> 00:02:27,930 ‫it's durable, it's dynamic. 65 00:02:27,930 --> 00:02:30,720 ‫The storage type is Object, so you need to use the S3 API 66 00:02:30,720 --> 00:02:33,120 ‫to access the Amazon S3 objects. 67 00:02:33,120 --> 00:02:35,790 ‫And then you have Atomic Operations, 68 00:02:35,790 --> 00:02:39,330 ‫so you can get, put, post, and so on, with versioning. 69 00:02:39,330 --> 00:02:42,000 ‫For the pricing you pay, of course, for Amazon S3 pricing, 70 00:02:42,000 --> 00:02:44,580 ‫so storage plus requests, plus data transfer. 71 00:02:44,580 --> 00:02:46,080 ‫And to get access to Amazon S3, 72 00:02:46,080 --> 00:02:48,600 ‫you need to make sure you have the proper IAM permissions. 73 00:02:48,600 --> 00:02:49,830 ‫This is network based storage. 74 00:02:49,830 --> 00:02:51,750 ‫So we have a fast access 75 00:02:51,750 --> 00:02:54,270 ‫because we have dedicated AWS bandwidth, 76 00:02:54,270 --> 00:02:56,460 ‫but it's not the fastest. 77 00:02:56,460 --> 00:02:57,293 ‫And of course, 78 00:02:57,293 --> 00:03:00,360 ‫Amazon S3 is shared across all your Lambda Invocations 79 00:03:00,360 --> 00:03:03,690 ‫because, well, it is an external storage of data. 80 00:03:03,690 --> 00:03:06,150 ‫Finally, for Amazon EFS, we have Elastic. 81 00:03:06,150 --> 00:03:07,590 ‫It's durable, it's dynamic. 82 00:03:07,590 --> 00:03:09,330 ‫The storage type is file systems, 83 00:03:09,330 --> 00:03:13,380 ‫so we access it using any kind of file system operation. 84 00:03:13,380 --> 00:03:14,700 ‫We're going to pay for the storage, 85 00:03:14,700 --> 00:03:16,600 ‫the data transfer, and the throughput. 86 00:03:17,760 --> 00:03:19,770 ‫And because it is mounted 87 00:03:19,770 --> 00:03:21,660 ‫as a network file system on your Lambda function, 88 00:03:21,660 --> 00:03:25,230 ‫you're going to have very fast access to your data. 89 00:03:25,230 --> 00:03:27,300 ‫Finally, because it is a network file system 90 00:03:27,300 --> 00:03:28,680 ‫this is going to be shared across 91 00:03:28,680 --> 00:03:30,660 ‫all your Lambda Invocations. 92 00:03:30,660 --> 00:03:31,590 ‫So hopefully that makes sense 93 00:03:31,590 --> 00:03:33,540 ‫into the different storage options for Lambda. 94 00:03:33,540 --> 00:03:36,573 ‫I hope you liked it, and I will see you in the next lecture.