Steps to Create Serverless Application Run locally & Deploy In AWS | AWS Serverless Application

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone welcome back to my channel this is sambu from cloud Tech today I will talk about how we can uh create our uh in local some application by using AWS Sam module in CLI and then how we can deploy that application to AWS and if you want to run that particular application in your local then how we can run that application that part I will talk about today okay guys so let's go to that uh in my previous session I have already installed how we you can install the Sam C I have already demonstrated so if you guys not yet watch that video please have a look at okay guys so let's move on to that uh Sam CLI that command line okay so just go to here and so what we need to do first we need to create a Sam Sam application so how we can do Sam just type in it then it will start initializing your application like basic like you want to create your application by using aw's provider template or you have your custom template in in some location that by using that also we can do so for this today's demo Let's uh move on to the AWS provided template okay and here we have like different kind of option what kind of application you want to hello world uh with that Lambda like you want to do that or just one simple hello world example you want to do that there are multiple template is available here as for your need you can do that so for this today demo let's select the first one itself okay and the other one is the use the most popular runtime packages you want to use the most popular runtime packages or you have your custom this is like a python so I will recommend it guys this most popular runtime means which is Inu is coming but that package might you don't have in your local right so I will request uh let's select that option let's select the no then we'll get that all the option then from that option we can choose like which one I want to use in my run time okay guys in my local I have already installed python 3.10 so let's select that python 3.10 okay guys so 20 and then how we want to take the Jeep or image let's select the Jeep one and now another option is would you like to enable x-ray tracing like this x-ray I didn't demonstrate anything about that maybe in my subsequent video I will talk about x-ray so for this today's session let's select the no only and would you like to integrate this to Cloud watch if you want to integrate this thing in your Cloud wise then you will get all the logs details all so for this today's demo let's will not use that also and you would you like to Lo like a structure of login right how you want like Json format or some other Lambda format okay so let's select that Json format only yes okay now what the project name you want to create like a project name like here the sample by default is given the Sam app so we can select that also okay so now our project is started initializing and it's created and it is saying that we can like create pipeline CD Sam and Sam pipeline bootstrap or maybe Sam template Sam validation and there are multiple things is there okay guys and if you want you can invoke also so before inv first what we need to do we need to build this Sam so let's go to this Sam okay and then Sam build this project first okay so so let us build if you want you can validate also Sam validate this is the command and now build is going on by using python I I just now I told you right in my system I have the python 10 so it is using that only and it is in progress so let us complete so our build is successful if you see here right and then we had after build complete we can do Sam validation command you can use or Sam local invoke also you can use or maybe Sam deploy we can deploy also deploy means it will deploy to our AWS okay guys so first let us run this in our local okay Sam invoke okay let us try so it is because it is asking that invoke and then we need to give this uh what the function name so our function name if you see here right when it is buil so hello world right so see and build build sueded and this is our function right so let us try that the string right let's put the dou code here and then Sam locally require doer have you get got to install and running doer okay doer is not running and install so let us first start the docker here so okay Docker I don't have here so before that we need to install this is also one valid point guys keep in mind Docker H also we need to inst install here Docker doer in Windows okay install doer uh doer desktop let's quickly finish this download okay I think I have already this download let us use that is not showing here okay I will pause this video for some time I will come back okay guys so meantime let's complete this Docker this is also one pre request thing I forgot to mention this thing guys so keep in mind okay actually I was having this Docker in my local uh if you see right I just now I installed right to give the Dem I just uninstalled the docker so let us complete again so is going on meantime what we can do doer we can also we can log in here i' already logged in here we can use this Cloud de one only so install uh download is completed let us install [Music] [Music] that so installation is going on okay I will pause this sometime for this uh Docker installation then I will back okay okay guys so let's finish this doer installation guys Docker desktop installation is completed let's close this let us try that without uh log to the docker desktop it will work or not no still not working so we have to log in the docker okay so or maybe what we can do let us first log in the recommended finish yes seing toer engine okay so it is already logged in here as a cloud Tech IND okay guys so let us try again open that CMD again let's go to that Sam application and Sam s local running here if you so it is started building that image okay guys it will take few second so let us complete this basically it is building the docker image okay guys so let's complete this what is mounted and now see we got the correct response our sample hello world response also we got okay guys now we are able to see here right so if you want to start right I I showed you there are multiple command here we can utilize that Sam here deploy is there delete in it list and then we can check that uh start API also we can check as API or start Lambda we can check I will show you that H all file basically it is created that part also okay so Sam uh use this uh uh this start API also okay so let us see now you guys can see the Lambda is initializing here so it will take few second to complete this Lambda initialize so now Lambda initialization is done now our API response also came so now API is running so if you just hit this URL in this browser then we could able to see our response like that hello word message let's see now we can able to see that response also as a hello world right so now our API also is working fine so looks good so now come here so now it is running right and if you want to uh suppose uh now do that uh what I can say list okay so now I terminate that uh whatever running that application rest here right I I am going to terminate so now I will show you that what all details is created basically so let me show you that open the P CH by using pyam also whatever CLI we have created this project right by using pyam also we have created since we have already installed the s right we can able to see here so it is coming it is loading basically so now our application is there and hello world these are the apps and what details is there it's basically one Lambda all the details is having here okay guys so these are the thing and if you want you can create from here also like uh deploy this application to AWS okay so let us try that so what we are going to do we are going to deploy this application so to deploy that uh let me show you that deploy and then guide gu okay sping mistake I deploy now our deployment is started and it is asking what could be the stack name so before that let me show you that our stack what we have in our stack in AWS so let's go to here and go to this uh what I can say stack cloud formation if you go to the cloud formation we can see able to our stack here so let us see here only we have one default stack which is Sam C but uh let us create our stack here so let's move on to that and just give the Sam uh St something like that and which region this is our Virginia region so let's select default and confirm yes and aw c will create a im Ro yes let us create required permission disable roll back no if it is anything goes wrong then everything should be roll back okay so if you disable then it won't be roll back okay so let us disable hello world has no authentication is this okay yes for now there is no required SA the argument in file not required now looking resource for creating okay so it is started this one so let us see now it is started managing the bucket initializing the deployment stack name this one and this is the thing and this is the bucket name we are going to use and waiting for the now it is started do you want to deploy these changes now our uh this tag also came right yes so let us deploy meantime and let's see here this tag what it is doing so it is in creating progress so let's go here and if you go resource hello world that first I am Road it started creating here it will take couple of second to complete this once it is completed right we are able to see that let me show you that in the Lambda function it will going to create one Lambda function also so let's go here yeah it started creating a Lambda function so just wait for some time is in progress still so what all thing is going to do let's create let's complete all this thing then we are able to see so event we can check that serverless rest API and these are the thing is going on right one by one so let's finish all this thing so resource still it is now Lambda it's completed permission is completed I roll API get everything is completed right looks like so stack is computer so let's go to the Lambda function and have we can see here Lambda function so this Lambda function is nothing but whatever hello world we give right same Lambda function is deployed here let me show you that and AP also it is attached here and if you see here right whatever code we have seen in our local same thing it is deployed here and if you want to run here also you can run suppose test okay and then click on okay and then run it now we can see here also hello world by using this API Gateway also and if you want to trigger from fi Gateway that also you can do this is our fi G to end point so if we hit here let us try see here also we can see the hello world message so API Gateway end point also we could see here details which we have deployed through rest start API rest right rest AP in our local same thing it is deployed in this hello world in this AWS resource also so this is how we can run the application locally and if you want to deploy that application to AWS we can deploy and for suppose this application we are doing some development here or maybe we are changing some message right hello world suppose I am going to change here say cloud okay suppose I going to change something code here and then that code what we can do here let me show you that Sam uh what we can do like uh help okay so init is there have that deploy is there and then we have Sam uh Sam build then we have to build this project again whatever changes we have done now is going on so build is completed and if you want to deploy again so then Sam deploy g d then same step we have to follow whatever changes we have done then that step that same thing will deploy again in this AWS resource okay guys so this is how we can access our Lambda and if anything goes wrong then what we can do we can check the logs also but checking the logs what we can do let's go to that cloud watch uh let's go to this Cloud watch and let me show you that logs also here logs groups and from the logs group we can able to see the logs also okay guys so let's go to here and logs group is created and if you come here then we can check the logs details also what is happening all these things so if you go here now it is see all this thing right all this if any error or any anything goes wrong then we can see those message here okay guys so this is how we can deploy we can create build and we can uh work on this okay and if you want to delete if suppose all the resource at a time whatever resource is created you want to delete right then if you just go to this tag and then delete this stack then it will delete everything at a time or in single s it will delete everything suppose whatever stack having this all this thing it will delete let me show you quickly that now our Lambda function also will be delete let me just quickly show you that go to here press now Lambda is deleted right and just see but logs group will delete I don't think so it will delete it this log group will not delete it will be there remaining we have to clean up this manually these log groups it will be there okay guys but apart from log group everything will be deleted l f is deleted everything iset API gway all this thing will be deleted whatever thing is there it will be deleted and delet it in progress okay guys so that's all about this Sam CLI so I hope this session will helpful to you guys and if you feel this video is Val I will request you guys please subscribe my channel and share surrounding with your friend so that that will really Inspire to me and that will really help to me I will come another new video in my next subsequent video okay guys CH see you bye
Info
Channel: CloudTech AWS & Azure & GCP for Everyone 🤝
Views: 248
Rating: undefined out of 5
Keywords: Create Serverless Application Run locally & Deploy In AWS, lambda, cloudformation, aws sam cli, aws sam cli create serverless application, run locally serverless application, create api gateway & run, create api gateway using sam cli, create api gateway using cloudformation, Install docker Docker Desktop in windows, AWS Serverless Application, Install docker Docker Desktop on Windows, run Docker on Windows, The Complete AWS SAM Workshop, AWS SAM example applications and patterns
Id: GIitQTjdwws
Channel Id: undefined
Length: 20min 11sec (1211 seconds)
Published: Sat Dec 23 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.