1 00:00:00,250 --> 00:00:03,440 ‫Okay, so let's have a look at the synchronous invocations. 2 00:00:03,440 --> 00:00:06,000 ‫And actually when we had our code over function, 3 00:00:06,000 --> 00:00:09,390 ‫and we just did test, then this was a synchronous invocation 4 00:00:09,390 --> 00:00:12,410 ‫because we are waiting for the results of the invocation, 5 00:00:12,410 --> 00:00:13,720 ‫and we get it here in this window. 6 00:00:13,720 --> 00:00:15,380 ‫If it took maybe two minutes 7 00:00:15,380 --> 00:00:17,140 ‫for this invocation to complete, 8 00:00:17,140 --> 00:00:18,450 ‫we would have waited two minutes 9 00:00:18,450 --> 00:00:20,480 ‫to get the execution results. 10 00:00:20,480 --> 00:00:22,470 ‫Very simple, this is what goes on through the UI. 11 00:00:22,470 --> 00:00:23,389 ‫The other thing we can test 12 00:00:23,389 --> 00:00:27,060 ‫the synchronous invocation with is using the CLI. 13 00:00:27,060 --> 00:00:29,260 ‫So I'm going to open AWS CloudShell 14 00:00:29,260 --> 00:00:30,490 ‫which is available in my region, 15 00:00:30,490 --> 00:00:33,810 ‫otherwise you can just use the CLI for this use case 16 00:00:33,810 --> 00:00:34,800 ‫with your terminal, 17 00:00:34,800 --> 00:00:37,760 ‫and in here, as we can see the errors command line 18 00:00:37,760 --> 00:00:38,600 ‫is available to us. 19 00:00:38,600 --> 00:00:41,170 ‫So if I do give us management version 20 00:00:41,170 --> 00:00:43,659 ‫we get the fact that it is version 2.1. 21 00:00:43,659 --> 00:00:44,492 ‫So this is perfect. 22 00:00:44,492 --> 00:00:48,370 ‫Okay. So let's use this CLI to list our functions. 23 00:00:48,370 --> 00:00:52,250 ‫So it was Lambda list functions 24 00:00:52,250 --> 00:00:54,400 ‫and this should list the functions within the region. 25 00:00:54,400 --> 00:00:56,360 ‫Make sure to add the region flag 26 00:00:56,360 --> 00:00:59,250 ‫if you're using this CLI so for me, it's EU west 1. 27 00:00:59,250 --> 00:01:00,760 ‫if using the CLI in your terminal 28 00:01:00,760 --> 00:01:02,438 ‫and not using CloudShell, 29 00:01:02,438 --> 00:01:05,270 ‫but here we go, we have found that we have our function name 30 00:01:05,270 --> 00:01:06,540 ‫or function ARI and the runtime 31 00:01:06,540 --> 00:01:09,240 ‫and so on out of the function that is right here. 32 00:01:09,240 --> 00:01:12,050 ‫So next we want to do a synchronous invocation 33 00:01:12,050 --> 00:01:14,850 ‫from the CLI of our lambda function, and for this 34 00:01:14,850 --> 00:01:16,530 ‫this just go into our code and 35 00:01:16,530 --> 00:01:18,820 ‫under a synchronous.sh we have the different commands. 36 00:01:18,820 --> 00:01:21,640 ‫So I'm on Linux Mac because this is CloudShell 37 00:01:21,640 --> 00:01:23,560 ‫and this is using the CLI V2 versions. 38 00:01:23,560 --> 00:01:24,900 ‫So if you see have CLI V1, a version 39 00:01:24,900 --> 00:01:26,425 ‫one version is going to be a slightly different 40 00:01:26,425 --> 00:01:28,360 ‫for the command line 41 00:01:28,360 --> 00:01:29,760 ‫but you should have version two by now. 42 00:01:29,760 --> 00:01:32,545 ‫So use this command and then you paste it. 43 00:01:32,545 --> 00:01:34,670 ‫And this is going to invoke my function name 44 00:01:34,670 --> 00:01:37,450 ‫hello world is going to pass in this payload. 45 00:01:37,450 --> 00:01:39,300 ‫And then it's going to write the response 46 00:01:39,300 --> 00:01:40,650 ‫of json as a result. 47 00:01:40,650 --> 00:01:43,820 ‫And I can remove this region argument right here. 48 00:01:43,820 --> 00:01:44,830 ‫Otherwise it's not going to work. 49 00:01:44,830 --> 00:01:46,410 ‫So I press enter. 50 00:01:46,410 --> 00:01:49,930 ‫And it says a function has not been found, for some reason. 51 00:01:49,930 --> 00:01:51,410 ‫So yes, the name is not hello world. 52 00:01:51,410 --> 00:01:53,390 ‫It is a demo Lambda in this example. 53 00:01:53,390 --> 00:01:55,370 ‫So I'm going to go in here 54 00:01:57,000 --> 00:01:59,200 ‫and change the function name to demo lambda. 55 00:02:03,360 --> 00:02:06,140 ‫As we can see now this is working, we get a 200 result back. 56 00:02:06,140 --> 00:02:08,840 ‫And then if I do go into response to json 57 00:02:08,840 --> 00:02:10,870 ‫we get the value 1 as a response to that. 58 00:02:10,870 --> 00:02:13,450 ‫I mean, my synchronize invocation has worked. 59 00:02:13,450 --> 00:02:14,700 ‫So that's it for this lecture. 60 00:02:14,700 --> 00:02:15,533 ‫I hope you liked it. 61 00:02:15,533 --> 00:02:17,420 ‫And I will see you in the next lecture.