1 00:00:00,270 --> 00:00:02,220 ‫So we have different ways of running 2 00:00:02,220 --> 00:00:04,020 ‫our step function workflows. 3 00:00:04,020 --> 00:00:06,270 ‫The first one is to use a standard workflow. 4 00:00:06,270 --> 00:00:07,140 ‫This is the default. 5 00:00:07,140 --> 00:00:09,660 ‫The second one is to use express workflows. 6 00:00:09,660 --> 00:00:11,100 ‫And within express workflows, 7 00:00:11,100 --> 00:00:13,710 ‫we have the asynchronous workflows 8 00:00:13,710 --> 00:00:16,020 ‫and we have the synchronous express workflows. 9 00:00:16,020 --> 00:00:17,910 ‫So, we'll have a look at all of them. 10 00:00:17,910 --> 00:00:21,810 ‫So, for the standard default step function workflows, 11 00:00:21,810 --> 00:00:25,290 ‫the max duration of a single workflow is up to one year. 12 00:00:25,290 --> 00:00:29,400 ‫The execution model is exactly-once execution 13 00:00:29,400 --> 00:00:33,300 ‫and you may execute about 2,000 standard workflows 14 00:00:33,300 --> 00:00:35,160 ‫per second, which is a good rate. 15 00:00:35,160 --> 00:00:36,810 ‫And in terms of execution history, 16 00:00:36,810 --> 00:00:40,590 ‫you get up to 90 days in the console history 17 00:00:40,590 --> 00:00:43,200 ‫or you can use CloudWatch to have more logs 18 00:00:43,200 --> 00:00:45,510 ‫and you can keep the logs forever 19 00:00:45,510 --> 00:00:48,060 ‫with log retention settings in CloudWatch. 20 00:00:48,060 --> 00:00:50,580 ‫The pricing is going to be by the number 21 00:00:50,580 --> 00:00:53,910 ‫of state transitions, so going from one state to another. 22 00:00:53,910 --> 00:00:57,030 ‫And the use cases for using standard workflows 23 00:00:57,030 --> 00:00:59,880 ‫is for non-idempotent actions such as, 24 00:00:59,880 --> 00:01:01,863 ‫for example, payments processing. 25 00:01:02,790 --> 00:01:04,710 ‫Next, we have the express workflows 26 00:01:04,710 --> 00:01:07,440 ‫and as the name indicates, they're for short ones, 27 00:01:07,440 --> 00:01:09,720 ‫so, up to five minutes of execution. 28 00:01:09,720 --> 00:01:12,030 ‫But you have extremely high capacity 29 00:01:12,030 --> 00:01:13,410 ‫for extremely high rates. 30 00:01:13,410 --> 00:01:17,010 ‫So, you have over 100,000 executions per second 31 00:01:17,010 --> 00:01:17,843 ‫that you can do. 32 00:01:17,843 --> 00:01:19,380 ‫So quite a bit of volume. 33 00:01:19,380 --> 00:01:22,860 ‫Now, there is no way to track things in the console. 34 00:01:22,860 --> 00:01:24,728 ‫The only way to get execution results 35 00:01:24,728 --> 00:01:27,870 ‫and analysis is by using CloudWatch logs. 36 00:01:27,870 --> 00:01:29,460 ‫And you're going to be billed 37 00:01:29,460 --> 00:01:31,320 ‫by the number of the execution, 38 00:01:31,320 --> 00:01:34,920 ‫the duration of an execution, and the memory consumption. 39 00:01:34,920 --> 00:01:37,350 ‫So the use cases for express for Cloud would be, 40 00:01:37,350 --> 00:01:41,880 ‫for example, to do IOT data ingestion, or streaming data, 41 00:01:41,880 --> 00:01:44,520 ‫or mobile app backends and so on. 42 00:01:44,520 --> 00:01:47,906 ‫Now, within express we have asynchronous and synchronous 43 00:01:47,906 --> 00:01:50,430 ‫and the main difference I want you to remember 44 00:01:50,430 --> 00:01:54,540 ‫is that the asynchronous express workflow has at least once 45 00:01:54,540 --> 00:01:58,260 ‫execution model guarantee, and the synchronous type 46 00:01:58,260 --> 00:02:01,050 ‫of express workflow has at most once, 47 00:02:01,050 --> 00:02:03,060 ‫and the exam will test you on this. 48 00:02:03,060 --> 00:02:06,600 ‫So, when you're using an asynchronous express workflow 49 00:02:06,600 --> 00:02:09,960 ‫the workflow, the execution just starts 50 00:02:09,960 --> 00:02:12,192 ‫and we don't wait for the results and how do we know 51 00:02:12,192 --> 00:02:15,300 ‫if it has ended, and if the result is correct, 52 00:02:15,300 --> 00:02:17,670 ‫well, we'll have to check CloudWatch logs. 53 00:02:17,670 --> 00:02:20,040 ‫So, this is when you don't need an immediate response. 54 00:02:20,040 --> 00:02:21,900 ‫For example, for messaging services, you just want 55 00:02:21,900 --> 00:02:24,450 ‫to send a message, you just do it, but you don't wait 56 00:02:24,450 --> 00:02:26,370 ‫for the response whether or not the message 57 00:02:26,370 --> 00:02:28,200 ‫gets sent successfully. 58 00:02:28,200 --> 00:02:32,370 ‫So because we have an at least once execution guarantee 59 00:02:32,370 --> 00:02:34,830 ‫in case there are errors we can try again directly, 60 00:02:34,830 --> 00:02:36,600 ‫automatically from within step functions 61 00:02:36,600 --> 00:02:39,840 ‫and so it's possible for the same action to be done twice. 62 00:02:39,840 --> 00:02:42,690 ‫And so in that case, you must manage at the idempotence 63 00:02:42,690 --> 00:02:45,180 ‫to make sure that if you run the same action twice, 64 00:02:45,180 --> 00:02:47,670 ‫you don't have twice the same effects. 65 00:02:47,670 --> 00:02:49,260 ‫For a synchronous, at most once, 66 00:02:49,260 --> 00:02:52,500 ‫this is when we invoke an express workflow, but we wait 67 00:02:52,500 --> 00:02:53,610 ‫for the workflow to complete 68 00:02:53,610 --> 00:02:55,380 ‫and when we get the result out of it. 69 00:02:55,380 --> 00:02:58,080 ‫So this is, for example, when you need an immediate response 70 00:02:58,080 --> 00:03:00,060 ‫from the workflow itself. 71 00:03:00,060 --> 00:03:03,180 ‫So, for example, if you orchestrate microservices 72 00:03:03,180 --> 00:03:04,680 ‫and you want to make sure that everything 73 00:03:04,680 --> 00:03:07,770 ‫is working correctly before you stop the execution. 74 00:03:07,770 --> 00:03:09,570 ‫In that case, for synchronous workflows, 75 00:03:09,570 --> 00:03:12,016 ‫you can invoke them from the API gateway 76 00:03:12,016 --> 00:03:15,300 ‫or Lambda function and get a response from it. 77 00:03:15,300 --> 00:03:17,830 ‫And it's at most once because if there's a failure, 78 00:03:17,830 --> 00:03:20,970 ‫the step functions will not restart the workflow for you. 79 00:03:20,970 --> 00:03:23,400 ‫It's up to you to try again if you wanted to 80 00:03:23,400 --> 00:03:27,090 ‫but that's the kind of logic that you need to implement. 81 00:03:27,090 --> 00:03:28,950 ‫Okay, so that's it for this lecture. 82 00:03:28,950 --> 00:03:32,163 ‫I hope you liked it and I will see you in the next lecture.