Benefits and Use Cases for Serverless with AWS Lambda
Congratulations, you almost made it. There is one final module, and one final lab. We will discuss Serverless, and, when we talk Serverless with AWS, we're talking AWS Lambda. The benefits of AWS Lambda are multiple. There is no servers to manage, because it's Serverless. There is continuous scaling. It's very easy to scale, just ramp up the slider, and your function will perform faster and better. There is subsecond Metering, so you don't have to pay for hours as you do with EC2. You pay for sub-seconds.
Here's the use case. You upload your code to AWS Lambda and save it in the Cloud. You can use CLI, or you can use Web Console, or you can use some of the frameworks, such as APEX or Serverless framework. Then you set up your code to trigger from other AWS services, or maybe HTTP Endpoints, or some in-app activity. So those events, typically they're HTTP requests, they are going to Lambda. And Lambda would be exposed the API gateway by having an endpoint.
Then Lambda could run the code that you saved in the first step, and that code can execute whatever task you need to execute. And you pay only for the time that this function, this tiny, bitty, small function, has run. So Lambdas are ideal, they're perfect for infrequent and fast operations, and also operations that, which do not require constant 24/7 run time. Because most likely, if you're using your Lambda 24/7, having an EC2 would be cheaper than having a Lambda that is always, constantly being triggered and always executing.
But for some event driven operations where you don't need to run it all the time, you don't need to run that function all the time, Lambdas are great because they would allow you to save money. Some of the use cases, creating a RESTfull API and/or mobile backend. There's no need to create an EC2 instance, there's no need to create Elastic Beanstalk application, just a Lambda function and expose it via the API gateway. You can build Internet of Things backend and integrate with AWS Kinesis. You can use for Extract Transform Load operations, such as getting data to Redshift from S3. You can set up real-time file and stream processing. You can listen to multiple events from other AWS services, such as S3, or EC2, or CloudWatch.