1 00:00:07,110 --> 00:00:08,120 - Welcome. 2 00:00:08,120 --> 00:00:10,570 We are gonna start this lesson by talking about, 3 00:00:10,570 --> 00:00:13,230 one of the most important 4 00:00:13,230 --> 00:00:18,230 and well integrated services in the entire AWS ecosystem, 5 00:00:18,580 --> 00:00:19,963 AWS Lambda. 6 00:00:20,900 --> 00:00:22,850 So, what exactly is this service? 7 00:00:22,850 --> 00:00:24,600 It's deployed at a region scope. 8 00:00:24,600 --> 00:00:28,670 So, it's going to fit the profile of many of the services 9 00:00:28,670 --> 00:00:32,093 that operate as sort of a software as a service offering. 10 00:00:33,000 --> 00:00:37,860 Well, Lambda is designed to deploy serverless functions 11 00:00:37,860 --> 00:00:39,250 on behalf of the customer 12 00:00:40,250 --> 00:00:44,660 and these can be deployed using different run times. 13 00:00:44,660 --> 00:00:48,310 There are a list of supported run times 14 00:00:48,310 --> 00:00:51,100 that are managed by AWS with specific versions 15 00:00:51,100 --> 00:00:52,483 of each of those run times. 16 00:00:53,630 --> 00:00:56,380 But there's also an option, 17 00:00:56,380 --> 00:00:59,120 where you can deploy your own run time, 18 00:00:59,120 --> 00:01:01,223 using a specific framework. 19 00:01:02,320 --> 00:01:05,170 And so let's talk about these a little bit more 20 00:01:05,170 --> 00:01:07,900 when we dig into the actual configuration 21 00:01:07,900 --> 00:01:09,840 of a Lambda function. 22 00:01:09,840 --> 00:01:14,840 Lambda functions also support what we call triggers, 23 00:01:14,960 --> 00:01:19,960 which determine the conditions under which the function 24 00:01:20,150 --> 00:01:21,740 is invoked. 25 00:01:21,740 --> 00:01:25,760 And these triggers can range through so many different areas 26 00:01:25,760 --> 00:01:30,760 of the AWS ecosystem from EventBridge rules 27 00:01:31,290 --> 00:01:36,290 to S3 bucket actions, to SNS topics, 28 00:01:36,870 --> 00:01:39,993 to any number of other types of triggers. 29 00:01:41,870 --> 00:01:44,840 So, some of the different features of Lambda functions. 30 00:01:44,840 --> 00:01:47,120 First one I've mentioned triggers the ability 31 00:01:47,120 --> 00:01:48,660 to invoke a function, 32 00:01:48,660 --> 00:01:53,513 based on an event, action or time schedule. 33 00:01:55,530 --> 00:01:57,750 We have concurrency, 34 00:01:57,750 --> 00:02:00,270 which means if you have multiple triggers, 35 00:02:00,270 --> 00:02:02,230 happening at the same time, 36 00:02:02,230 --> 00:02:05,130 they can invoke multiple parallel copies 37 00:02:05,130 --> 00:02:06,870 of the same function, 38 00:02:06,870 --> 00:02:11,870 which gives it a great ability to scale according to load. 39 00:02:12,960 --> 00:02:16,860 But you also wanna make sure that you are optimizing 40 00:02:16,860 --> 00:02:21,860 for cost and potentially avoiding any unexpected load 41 00:02:23,000 --> 00:02:25,020 on backend resources, 42 00:02:25,020 --> 00:02:28,270 so you can configure the number of functions 43 00:02:28,270 --> 00:02:32,053 that can be invoked concurrently using this feature. 44 00:02:33,690 --> 00:02:35,770 The next feature, scaling, 45 00:02:35,770 --> 00:02:37,890 I mentioned already with the concurrency. 46 00:02:37,890 --> 00:02:42,890 So, if you have multiple actions invoking the same trigger, 47 00:02:43,230 --> 00:02:45,520 you can choose to have multiple copies 48 00:02:45,520 --> 00:02:48,160 of your function running at the same time. 49 00:02:48,160 --> 00:02:51,750 And this scaling is going to be very quick, 50 00:02:51,750 --> 00:02:56,343 especially when compared to EC2 or container-based scaling. 51 00:02:58,330 --> 00:03:02,780 And finally if you want to deploy your Lambda function, 52 00:03:02,780 --> 00:03:07,570 so that it has a footprint in one of your VPC subnets, 53 00:03:07,570 --> 00:03:08,893 it supports that. 54 00:03:09,990 --> 00:03:12,920 There are some limitations with Lambda functions, 55 00:03:12,920 --> 00:03:17,660 including timeouts that have a maximum of 15 minutes. 56 00:03:17,660 --> 00:03:19,650 So, it means you can't just execute, 57 00:03:19,650 --> 00:03:21,330 a Lambda function forever. 58 00:03:21,330 --> 00:03:24,363 It does need to have a specific end point. 59 00:03:27,070 --> 00:03:28,180 The different run times 60 00:03:28,180 --> 00:03:31,240 that are supported are for the most part, 61 00:03:31,240 --> 00:03:34,830 all the popular languages that are used today, 62 00:03:34,830 --> 00:03:39,830 Node.js, Python, Ruby, Java, Go, .NET 63 00:03:43,380 --> 00:03:46,740 and the ability to create a custom runtime. 64 00:03:46,740 --> 00:03:49,890 So, if you wanted to execute Fortran code 65 00:03:49,890 --> 00:03:51,680 in a Lambda function, 66 00:03:51,680 --> 00:03:53,380 there's a way to make that happen. 67 00:03:55,511 --> 00:03:58,370 Now, in terms of provisioning a Lambda function, 68 00:03:58,370 --> 00:04:01,150 there are a number of parameters 69 00:04:01,150 --> 00:04:03,500 that you need to take into account. 70 00:04:03,500 --> 00:04:05,470 Some of these are required, 71 00:04:05,470 --> 00:04:07,113 others are optional. 72 00:04:08,180 --> 00:04:10,240 Triggers are not actually required. 73 00:04:10,240 --> 00:04:13,953 You can invoke a Lambda function just by using the AWS CLI. 74 00:04:15,670 --> 00:04:18,340 The function code required, 75 00:04:18,340 --> 00:04:22,040 so the actual zip file 76 00:04:22,040 --> 00:04:26,763 or pasting code into the console and so forth. 77 00:04:28,480 --> 00:04:30,390 Permissions are required. 78 00:04:30,390 --> 00:04:32,340 And if you don't provide them, 79 00:04:32,340 --> 00:04:34,320 the Lambda function will create them, 80 00:04:34,320 --> 00:04:36,150 using a default template. 81 00:04:36,150 --> 00:04:41,150 This is just an IAM role that can be unique per function. 82 00:04:41,840 --> 00:04:46,800 And some of the default permissions include the ability 83 00:04:46,800 --> 00:04:49,660 to push metrics into CloudWatch 84 00:04:49,660 --> 00:04:52,163 and logs into CloudWatch Logs. 85 00:04:53,930 --> 00:04:55,763 Tags are optional. 86 00:04:56,700 --> 00:05:00,360 The compute resources while there's a default, 87 00:05:00,360 --> 00:05:04,110 you get to choose the amount of memory 88 00:05:04,110 --> 00:05:06,150 that is allocated to the function 89 00:05:06,150 --> 00:05:09,750 and that in turn determines the CPU 90 00:05:09,750 --> 00:05:11,263 that it can take advantage of. 91 00:05:13,000 --> 00:05:16,410 Network placement is optional. 92 00:05:16,410 --> 00:05:20,090 There are a number of debugging and error handling options, 93 00:05:20,090 --> 00:05:23,453 including the ability to use X-Ray tracing of your code. 94 00:05:24,290 --> 00:05:28,280 And that afore mentioned concurrency option 95 00:05:28,280 --> 00:05:30,730 is also something that you want to consider 96 00:05:30,730 --> 00:05:32,040 that even though it's optional, 97 00:05:32,040 --> 00:05:36,110 you may want to have a hard coded value for every function, 98 00:05:36,110 --> 00:05:40,913 so that it can't be invoked more often than what you expect.