Hey , Whats New ! - Episode1 - AWS Step Functions Workflow Studio!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everybody and welcome to our new show hey what's new um my name is derek bingham i am a developer advocate at aws and we are thrilled to have you here uh today to be part of our first ever show and i'm here with uh uh johnny so donate you want to introduce yourself as well hi everyone i'm donnie i'm a senior developer advocate working for asean and i'm in the same team with the amazing derrick and happy to be here to kick off the pilot of hey what's new yay thank you thank you very much so um as we mentioned this is a new show uh so we thought we'd start with a bit of an introduction of what we're trying to achieve um with this show so the watch news show um itself is going across um asia pacific um australia so i'm in perth and western australia uh we're trying to engage our community or also made the british community by putting a show on their channels so the what's the hey what's new show uh we'll be dealing with uh what's new in the aws um ecosystem what services features we've released recently and we won't be doing any slides we'll be doing street demos because we're developer advocates and we we love coding so hopefully that sounds of interest to you so every two weeks we'll pick something from the the database news blog and we will build you a demo and show you how it works so obviously um to make it a very successful show we need you the viewers to help so as you are watching across the number of channels um we can feed those chats into one and we will happily answer any of your questions along the way so please feel free reach out let's make this as a interactive show as possible so that's that's it for what's new anything you want to add there donnie about the show itself no i think you perfectly cover everything you're too kind um so what we're what we're going to start with today donnie what is the topic of today so what's cooking today is the aws step function workflow studio derek so um last month on june 17 i read a blog post about aws function workflow studio and as an automation fan i'm an automation fan this is really a good news why because it makes our job easier to define workflow so that's what i'm going to cover for uh today's session we're going to cover a bit about that functions and then workflow studio what is going to solve the problems and how to use the workflow studio and also some code oh code we like code cool so uh shall i share your screen tony and shall we get started definitely yes so hopefully everybody should see that there we go cool okay so i mentioned about the blog posts on june 17th and this is the blog post so if we scroll down i hope it's not too small for all of you uh let me try to yep i think is much more so if we scroll down uh marcia the author of this article perfectly mentioned the announcement with in this paragraph that workflow studio is great for developers who are new to stack functions because it reduces the time to build their first workflow and provides an accelerated learning path where developers learn by doing i think this is a really good announcement of the workflow studio now um so as you know the announcement is all about the new feature within editable step functions and before we talk about workflow studio let's talk about aws step functions right and why it matters to us so if we go to the editable step function service page we can read few informations about step functions um so according from this page um aws.function is a local visual workflow service used to orchestrate aws services ultimate business processes and builds a first application now one keyword here um in in for step function is workflow right and and what is it what is workflow so in a nutshell workflow is a model of a process in our application uh it consists of several entities and actions to get from one entity to another entity from one place to another place right so i think this is really important direct because um um i mean defining back the work what workflow is and uh how ed of the step functions uh it's going to solve this problem it really helps us developers to build application in in in real life so talking about the workflow that it can be like how we model the process on how uh to publish blog posts we start from draft we send to editor and that's a decision action between approve or written back to draft and if it's approved it can be published right or probably like if you're building an e-commerce application you can model your checkout process with workflow as well so that's what we're going to talk about derrick cool yeah so now if we go to adobe function dashboard here we don't see workflow right we see state machines so how does workflow correlate with state machine now state machine is a subset of a workflow remember that in workflow we need to get from one place to another now in order to do that the every place needs to be defined as a state so it could transition to other states the purpose of state machine is to hold this state of the model and for developers like us like you also direct more modern awesome we need to handle process right um we need to handle the process and break it down to a couple of stages right and and for me the easiest way uh for me to understand how state machines can help us is by moving out those stages in our code and deal and delegate it to other surface that can handle the sequence and state for each stage so yeah what would you use typically donnie uh before the event of technologies like workflow service and step functions oh that's a really good questions uh and apparently i already prepared a screenshot of how i traditionally uh use this kind of uh breakdown for the stages you know my application and it's called the conditional programming so let me give you an example so if you're building an e-commerce application and you need to build checkout process the checkout process consists of a couple of stages like for example upon receiving the request to checkout our application needs to check if the item is available or not in the inventory in our inventory with inventory service you can see that i have this function a check inventory based on the order id if some of those items are not available then you need to inform the customers we can have this conditional program here we have if if it doesn't have all these items we need to notify the customers and inform them the process is stopped why because we don't have any items in your order and if all items are good in the stock inventory we can go to the next stage and that is payment processing you might want to check if with the payment service if everything's good if not then you need to inform the customer again and the process is stopped again and if it does then you can proceed with the next process and that's creating the order uh info and create the shipping order and also notifying the customers now this is an ultra simplified sample on how we can leverage conditional programming to process the request in real life it can be more sophisticated and highly depends on your use cases now with this approach if something goes wrong it could be become really painful for us to retrace the request right and and for me the biggest problem is that we are relying in this line to do uh our business logic now would be nice if you can delegate this logic right direct okay um so uh this is the step functions that i created to illustrate the same checkout process that we discussed earlier and it looks like this um i can explain a bit yeah can we zoom in a bit there yep apparently how do you have it yeah let me zoom in okay so here it is it looks much nicer yeah not only it looks nicer but it really helps us to build workflow in reliable and scalable manner and this is one of the reasons why is that function is one of my favorite services it helped us to decouple the business logic along with additional features like implementing a retry mechanism uh integration with aws services especially aws lambda and also we have the uh the ability to control the flow like we can do branching we can do parallel processing we can do asynchronous toss which is awesome now um one thing though that to form a visual workflow like this with edible step functions we surely need to use a language so you can understand what we want to build and that language is called as amazon states language and you can see the description of its statement here and there's also another page that you can visit uh statesdashlanguage.net um i think this has same documentation now uh for some of you uh that might think what another language okay so hear me first i had the same talk at first but when you start building the state language um sorry building the state machines with the state language using amazon state language or asl it's really simple and it's easy to understand and what makes it easy to understand is its convention is intuitive meaning meaning that i don't need to think twice to know what exactly this statement is going to do but yeah i'm still going back and forth this page uh from time to time whenever i need to build a state machine now going back to the workflow studio now so the workflow studio is a new feature within aws functions to make your life easier to build serverless workflow why because you don't need to learn the amazon stats language anymore you can simply use the workflow studio to create [Music] the workflow okay so [Laughter] it's a highlight for me [Laughter] glad that you love it derek um so okay so in this in this demo i'm going to use the checkout example that i mentioned before so we're going to transform all of this conditional stuff here to visual workflow and for this i've already created uh two lambda functions oops let me try to reload so if i will create two lambda functions you can see it here i have two lambda here and to process inventory and also to do the payment checking nothing fancy about the code it's actually just giving me a random status here you go so yeah so it's just giving us the random status and the is going to output us as a json and i'm going to utilize this property status in the start function in the state machines same thing with the check payment um i actually use the same code but yeah so and then uh we also have one sns topic here uh here and and this one's to publish the notifications to my phone yeah and then and one i am role uh to grant access from aws lambda to uh to the uh sms topic and um all of these resources were created using the inferible two for the development and that is aws cdk i should give the drum roll for cdk can i do that you should do it's well worth the drum roll don't like okay so let's uh let's rewind a bit and for um and all of these resources are what i created using the inferable tool for development and that is cdk i just love cdk yeah me too yeah it really deserves a dedicated drum roll um yeah and um sorry yep no so for the for those of us for those people um watching could you do a quick explanation the elevator pitch of the cdk for them definitely cloud development kit or cdk is a magic it's a magic that we can define all of our resources we can provision all resources in reputable and predictable manner using our preferred language like for example i built most of the let me let me try to show my code here quite quick we we can see your browser in a minute [Laughter] which is really interesting but i'm sure you're doing on the other screen something a lot more interesting i did so yeah so these uh this this is the cd gap that i use um so so it's just a quick overview that these cdk applications defines all the resources that i created for this demo for example i use this uh this lambda rule to give access to edwards lambda and then i have this policy statement to uh to uh to trigger to lock the all the logs into the amazon hot watch and i have this a lambda function here right for checking inventory and also checking the payment so yeah so and i also have the assignments topic here and i added the subscriptions to my phone number and it's really cool right a cdk with cdk you can proficient on the resources that you need to bootstrap your applications um in reputable and also practicable manner it really helps us to accelerate our development so if you have an um uh if you haven't used cdk before i really recommend you to use it and uh the the the main thing for me about cdk no json or yaml is seen in the making of this um so that that's that was that's what i love yeah i really love it i mean i'm i'm really fam um i'm really familiar with reading the api and that's something that i do that uh since a long time ago like that right and that's the same thing that we whenever we build an application with cdk that we go through the api and then we use that kind of api to professional resources so uh it's really comfortable for me yep cool well that's the cdk let's get back to the workflow oh yeah so uh okay i almost forgot okay so so here's the demo yep so um so here's the demo let me open it up for you oh this one yeah so um let me i think it's much more easier for us to okay so uh so the demo we'll start with checking the inventory first and this is going to be adapter function and then we're going to add the uh flow which is the choice based on the return that we get from the lambda function and then if the status is false then it's going to send an information through sns topics and then if it went well then it goes to the next stage which is checking payment and the same thing with this uh with the choice that we have here uh when we arrive in this state with the payment checking we're going to have a two kind of um condition we're going to if it's went well it's going to send the information to customers that the order is a success otherwise it's going to send out the information that the payment failed so that's exactly what i'm going to do and let's create one great state machines so um so when you if you want to use these um these new features so workflow studio you need to choose this option and then you can go click next and there you go you have this nice drag and drop visual studio so the first thing that we need to do is that we need to uh drag our lambda here right and then uh the next thing that we need to do is that we need to add the conditional uh flow which is the choice because we can click on this step flow and then i put it here right and then um don't worry about the uh naming i'm going to we're going to uh go through that later on and then uh so once that it go it goes from the uh inventory checking we need to go we need to define another lambda function here yep this is for payment and then we're going to add another choice here here and then oh and then what we need to do now is that we need to use the sns uh to to inform the customers right yep okay so once that you have this nice uh workflow um then you can uh you can start my professor preference is just to configure later on once that i get the workflow up and going so uh we can choose the function name here like for example i'm going to use the check inventory and then um and then the next state is choice lambda check inventory i think that will be make more clear for us uh tech status uh inventory and then now here's the thing but if you use the choice flow uh you need to add a conditions right and i mentioned that we're going to use the the json status which is the returns from the lambda and then we can choose the operator is equal to boolean constant false and then it will go straight to this sns publish all right and i'm going to sns inform customer notify inventory field and then we can choose the topic which is the i for card the topic name um that's supposed to be the workflow oh there you go walk through a studio topic yeah right and then uh okay so we we are done with this uh with this uh workflow on this side and then let's go on this side same thing uh we can define the okay so here's the thing if you don't see the lambda functions right you can put the uh the arn you can put the rn here so that means that for the payment i can just copy and paste here nice and then just paste it here but cool so let me change it to lambda amen and then uh this one's uh check payment status it is free man um and then uh this is supposed to be uh notify uh payment field are we going to use the topic the same topic it applies to my phone number yep yep and this one notify success let's hope you remembered your phone number it's oh he knows their own phone number [Laughter] only for this demo i already memorized it correct okay so now we need to add these conditions um if the status is false um equal to false boolean constant false that means that we need to go to the notify payment field okay so i think we have everything properly configured but and then we go and uh we can go to next um here is the uh the amazon stat language and you can also see the nice diagram here and we just click next hey what's new uh step seven demo and then i just need to create state machine okay it's going to take a while um um so yeah so that's that's that's the the overall process on using the workflow studio yep we had a few questions in the chat that the first one was um a suggestion that maybe you should smile more um thank you so yeah yeah take that on board okay um thank you born for tech uh the other the um question was from crowdcaller on twitter so both these questions came from twitter um how to handle transactions across different states no i sent there's a number of um samples on aws samples about long-lived transactions with step functions so i sent that in the chat but there's any other advice that you can give cloud crawler that'll be yeah so that's really good questions and one um if you're building this services that's a one pattern that i really love to use to manage the transaction state that's called the saga pattern so um so that's something that probably you want to to look into the saga button and i also say that i already built a couple of demos on stat function i would be more than happy to share with the audience uh but for the interest of time um the statement these that functions really like a like i don't know i think it's really well built for for defining the saga pattern especially in micro services there's a nice um piece of documentation on the aws yes site that i'm just going to paste in all around the saga pattern um it's also a good good place to start um awesome cool okay so um let me start the execution now here i think i don't it doesn't require any input but just uh but here i can start the execution yes okay so we can see that's quite fast um okay so now i've received the message from the uh from sms i'm not sure if you can see it uh can you see it okay i can see a message yeah okay you can see the message i think it's okay so yeah there you go so it works um unfortunately i'm um not the lucky customers for today's uh because it just informed me that the um the e-commerce app doesn't have all the inventory that i order so yeah let's do it again it's going to take some time direct until oh no it's fail again so so yeah and another thing about the workflow studio is that once that you have your um your your stat machines um you can and if you want to edit it you can easily do that by following this step and then here you go there's a nice button uh with this uh tooltip here uh new and then there you go then you can redefine your stat machine again with workflow studio nice now i think we're we're definitely demonstrating the part of workflow studio and we're also demonstrating how live this um this broadcast is it is uh also a win so um we're running out of time now donnie we're just um finishing up i think uh that's that's half an hour and that's our how long we we intend to to run these shows from um yes one more one more thing if you want to test this demo you can head to the github repository as i put all uh the cdk application and also the lambda function and once that we've already have this video uploaded into youtube or facebook's i'm going to update the readme file so you can see the video again awesome that's fantastic i've uh i put a link to the github repo in the chat nice thank you copy and see yeah i i could read your mind i could read your mind so uh we'll just wrap up there um thanks tony that was an awesome uh demo uh of workflow studio instead of using step functions um just a summary um so if you want to use step functions it's all about uh low code to um obstruct away all your business processes uh to build serverless applications and workflow studio is how you bring that all together in a visual banner so you demonstrated that beautifully beautifully so um that's the show for for today um this has been a bi-weekly show if you've got any suggestions any feedback um please either hit donate myself up on twitter our handles are there or reach out to our um email address which i'll put in the chat as well um to um you can send us an email send us any feedback that you have and we'll be happy to um yeah respond so yeah so thanks thanks for me donation anything to say to our our great audience uh watching um um thank you derek yeah so i think um i i hope it really helps you to understand what this announcement is and hopefully that you can get started to build your first step machines to uh streamline your business process and um using state machines i think that's all and i want to do one more sound effect okay go if i may yes thank you everyone thank you for watching thank you derek thank you okay see you folks until next time bye
Info
Channel: Derek Bingham
Views: 48
Rating: undefined out of 5
Keywords:
Id: DhO-aASBCtc
Channel Id: undefined
Length: 28min 54sec (1734 seconds)
Published: Thu Jul 15 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.