AWS Lambda Tutorial For Beginners | What is AWS Lambda? | AWS Tutorial For Beginners | Simplilearn

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone let me welcome you to this new video learning where we're gonna learn about lamda and I'm Samuel from simply lung and I'm very glad that you're watching this AWS lamda tutorial now one day at office in a growing company there was this question going on between two IT personnel it was about the new role that his colleague Jessica has taken Benjamin the guy standing here wants to know about it and Jessica's job is new different and dynamic and interesting to she scale and manage servers and operating systems and apply security patches onto them and monitor all of these at the same time to ensure the best quality for application is given to the users and Benjamin was awestruck with the amount of work Jessica is doing and with the time it would take to complete all of them but Jessica being a very dynamic person very suitable for the job said it was easy for her to handle all of it and even more but that easiness on the job did not last longer as the environ grew more and more it being a startup company Jessica was getting drained and was not really happy about all her job as she used to be Jessica's manual way of scaling and environment did not last long and she was also finding out that she missed to scale down some of the resources and it's costing her a lot she needs to pay for the service that she was not at all using she sort of filled that she was at the end of the road and there was no way out from this manual tasks she was very desperate and that's when Benjamin suggested something and that brought back the peace and joy Jessica initially had Benjamin suggested about a service called lambda that can ease the work that Jessica is doing at the moment and lambda as happy as it looks like it's a solution that solves the manual repeated work and lot more and lambda introduced itself as the problem solver and started to explain the following things the very same thing that we're gonna learn about in this series so in this section we're gonna learn about the features of AWS lambda and we're gonna talk about what lambda is and then we're gonna talk about where lambda is being used in the IT or in the cloud environment as we speak and then we're gonna talk about how lambda works and some use cases of lambda and we're gonna be particularly discussing about the use case about automatically backing up the data that's put in the cloud storage let's talk about lambda in detail lambda automatically runs our code without requiring us to provision or manage servers just write the code and upload it to lambda and lambda will take care of it that means that we don't require any server to run or to manage and all you need to do is write the code and upload it to lambda and lambda will take care of it which also means that we can stop worrying about provisioning and managing servers the only thing lambda expects from you is a code that's working a double is lambda also automatically scales our application by a running code in response to each trigger our code runs in parallel and processes each triggers individually scaling precisely with the size of the workload scaling here is done automatically based on the size of the workload lambda can scale the application running the code in response to each and every trigger that it receives billing in lambda is meter on the seconds we only pay for the amount of time that our code is running which means that we not charge for any of the service the only payment required is for the amount of time the code is computed with a double use lambda we are charged for every hundred milliseconds we are actually charged for 100 milliseconds our code executes and the number of times our code is triggered and we don't pay anything when the code is not running let's talk about what is a double use lambda now lambda is one of the servers that falls under the compute section or the compute domain of services that AWS provides along with ec2 EBS elastic load balancer lambda is also a service that comes under the bigger umbrella of compute services in AWS and lambda allows us to execute code or any type of application with AWS lambda we can run code for virtually any type of application or back-end services all we need to do is supply our code in one of the languages that AWS lamda supports as we speak the languages that are supported by AWS lamda are node.js Java C sharp go and Python and lambda can be used to run call in response to certain events from other services and based on the event it can run functions and those functions can be of no js' Java C sharp etc now let's talk about where is lambda used there are a huge number of use cases for lambda and there are many ways a double is lambda is used specifically in the business world let's talk about some of them one news case is a double use lambda is used to process images when it is uploaded in an s3 bucket let's say the object gets uploaded in a nest a bucket in a format that we don't expect it to be which means the file needs to be formatted so it gets uploaded in a raw format and a double use lambda is triggered anytime a new object is added to the bucket and the images are processed and converted into thumbnails based on the devices the other end device that would be reading the data it could be an PC could be an Apple machine it could be an Android phone it could be an apple phone could be a tablet whatnot so based on the devices different formats lambda can get triggered and convert the video or kind of the picture into the different format that it requires another use case for lambda is to analyze the social media data let's say let's say we collecting the hashtag trending data and the data is received and it's added into the Kinney's stream to feed into the Amazon environment and lambda action get triggered and it receives the data and then the data is stored into the database which can be used by businesses for later analysis and some of the companies that have gotten tremendous benefit using lambda or Thomson Reuters bench links Nordstrom coca-cola robot are some of the companies to name at the moment that have received tremendous amount of benefit by using lambda let's look at how lambda works in other words let's look at how the complicated function behind-the-scenes work in a simple and in a seamless way so here our clients send data online send data to lamda and clients could be anyone who's sending requests to AWS lamda it could be an application or other Amazon Web Services that sending data to the lambda and lambda receives the request and depending on the size of the data or depending on the amount or volume of the data it runs on the defined number of containers if it is a single request or if it is less requests it runs on a single container so the requests are given to the container to handle and the container which contains the cord the user has provided to satisfy the query would run and if you're sort of new to containers then let me pause here for a while and explain to you what container is now container image is a lightweight standalone executable package off a piece of software that includes everything needs to run it like the codes the runtimes the system tools the system libraries and any of the settings needed and it is at the moment available both on Linux and Windows based application and container rise to software will always run the same regardless of the environment it's running on and containers isolate software from its surrounding for example there could be difference between a development and staging environment so that sort of isolated and this helps in reducing the conflict between the teams running a different software on the same infrastructure alright now that we know containers needed to understand lambda so if there are few requests it sends to a single container but as in when the request grows it actually creates multiple containers shares the multiple requests to the different containers there and depending on the volume depending on the size depending on the number of sessions the more number of containers are provisioned so to handle those requests and when the requests reduce the number of containers reduced as well and that helps in saving cost we're not running any resources and paying for it when we using them and in fact we're not at all paying for the resources we're only charge for the amount of time a function is running inside these containers now consider a situation where you have to set up a temporary storage and as a system to back up the data as soon as the data is uploaded which is a near real-time backup now a near real-time manual backups are nearly impossible and they're not that efficient to and near real-time manual backups that's what the business demands but that's not near real-time backup that to a manual one that's not at all efficient even if we come up with a solution of manually backing out close to near real-time and that's not gonna be efficient looking at the amount of data that will be put in and looking at the random times the data will be put into the source bucket and there's no way we can do a manual backup and they keep it as real as possible but if that's still your requirement we can use AWS lambda and set things up so AWS lambda manually handles the backup in other words for an impossible or a difficult situation like that AWS lambda comes for the rescue and this is what we do create a - s3 bucket 1 will be the source bucket where the data will be uploaded and the other one is and destination bucket where the data will be backed up from the source bucket and for these buckets to talk to themselves it's going to require an IM rule and then for the automatic copy it's gonna require and lambda function to copy the files from the source bucket to the destination bucket and what triggers the lambda function the lambda function is triggered every time there's a change in the metadata for the bucket and this data is then uploaded into the destination bucket and after setting all this up we can literally test it by putting a data in the source bucket that's gonna automatically replicate or that's gonna automatically copy the data from the source packet to the destination bucket all right let's see how we can replicate data between two bucket well we have a feature to cross region replicate in s that's a feature that comes along with s3 what if you want to replicate between two different buckets in two different accounts in those cases we can use lambda to replicate the data and between the buckets so you put one data or you put data in the source bucket and that data gets replicated to the destination bucket and let's see how that's done the procedure here will be to have two buckets to begin with and then create an IM role that lets you access to pull data from the source bucket and put data on the destination bucket and then create lambda files or lambda event or triggers to actually look for event in the source bucket and anytime a new data gets added lambda gets triggered copies the data from the source bucket and moves the data to the destination bucket and it uses the IAM role and policy for the needed permissions and in just a couple of clicks we have set up a temporary backup system that can run seamlessly without any manual intervention and that can be as near real-time as possible all right that's the concept and let's see how it is done real time through this lab so to begin with we need the two buckets so I have here a source bucket and a destination bucket and the source bucket as of now do not have any data in it so as the destination bucket all right so that's one down the second would be to create an IM role alright so let me create an IM role and the role is gonna have this policy in it a policy that's allowing get object on the source bucket and a policy that's a loving put object on the destination bucket and here I'm gonna use or I'm gonna paste my source and destination buckets AR n alright Carew services guru s3 source bucket all right click on the source bucket the bucket TRN so that would be the source bucket AR n right on on the destination bucket copy the destination bucket AR n and this is gonna be my destination bucket erm so with this I'm gonna create a policy alright good I am and create a policy now I I have already get a policy with the same information right destination bucket hey RN and a policy is available with the name s3 bucket copy lambda attach the policy to the roll right guru roles create a role lambda is the service that's going to use it in here attach the policy that we have created right give it a name and then create a role now I have a role created as well all right copy lambda and that's having the policy that we have created some time back now create a lambda function right so go to lambda create a function give it a name like s3 bucket copy all right choose the role that we want to use all right that's the role that we want to use copy one to create a function all right and in here we're gonna use node.js code right I have a sample code this can be used as template in here replace the source bucket with the name of the source bucket and the destination bucket with the name of the destination bucket this is a node.js cord that gets run when an even to get trigger it's now what's an even anytime there is a new object placed in the s3 bucket it creates an event and the even triggers lambda and lambda checks this Sora's s3 bucket fixed the data puts it in the destination bucket all right paste it here paste it here and click on save alright now before you click on save this ensure that you have the appropriate roles defined that's all you got to do click on save all right now I already have created a lambda function all right which is the same thing same code and the role is attached to it now it's running it's active now let's put this to test guru s3 pick the source bucket put some data in it all right and in theory those data should be present in the destination bucket as well there you go it's all done by lambda all right so what would we learn so far we started a discussion with the benefits of lambda like we don't have to worry about the server when we use lambda we don't have to worry about scaling for lambda it automatically scales up and scales down we don't have to worry about the cost as well because we're only paying for these seconds the code is running and and when the code is not running we're not paying anything to it and then we spoke about what is a W is lambda what it contains off and what it can do and then we discussed about the use cases of lambda and then we had a brief discussion about how lambda really works and how it scales up and scales down based on the number of requests that it receives and finally with it a quick lab about how lambda can be used for automatic backups I believe you really would have enjoyed the session about lambda we'll meet again in another AWS video learning tutorial like this thank you hi there if you liked this video subscribe to the simple learn YouTube channel and click here to watch similar videos turner up and get certified click here
Info
Channel: Simplilearn
Views: 330,618
Rating: undefined out of 5
Keywords: aws lambda, aws lambda tutorial for beginners, aws lambda java, aws lambda java tutorial, amazon lambda tutorial, amazon lambda java tutorial, amazon lambda example, what is aws lambda, what is amazon lambda, what is amazon lambda used for, amazon lambda function, aws services tutorial, aws tutorial for beginners, aws solution architect certification, aws certification training, aws training videos, aws, amazon web services tutorial for beginners, aws simplilearn, simplilearn
Id: 97q30JjEq9Y
Channel Id: undefined
Length: 17min 41sec (1061 seconds)
Published: Wed Jul 04 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.