About Lambda
(this post if part of the material I cover in my devops course)
What is Lambda?
- AWS Lambda is a serverless compute service.
- Use AWS Lambda to run code without provisioning or managing servers
- You organize your code into Lambda functions.
The Lambda service runs your function only when needed - Lambda runs your code on a high-availability compute infrastructure and performs all of the administration of the compute resources:
- server and operating system maintenance
- capacity provisioning
- automatic scaling
- logging
- With Lambda, all you need to do is supply your code in one of the language runtimes that Lambda supports.
- You only pay for the compute time that you consume—there is no charge when your code is not running.
Lambda Use-Cases
- File processing (for example when files are loaded to S3)
- Stream processing** (e.g use Lambda and with Amazon Kinesis to process real-time streaming data)
- Web applications
Combine Lambda with other AWS services to build powerful web applications. - IoT backends
Build serverless backends using Lambda to handle web, mobile, IoT, and third-party API requests. - Mobile backends
Build backends using Lambda and Amazon API Gateway to authenticate and process API requests.
When NOT to use Lambda
- In cases where you have functions that manage, and mainly call other functions, your function is mainly waiting, so not optimal about costs.
Consider using AWS Step Function - Don't use Lambda functions to jsut move data from one service to another.
Use service integration to do that (e.g, between API Gateway and DynamoDB) - If your code should run longer than 15 minutes
AWS Lambda features
- Lambda cab use environment variables
- Lambda function can be deployed with Versions
- You can create your runction in [Container images]. You can reuse your existing container.
- You can manage your code dependencies with Layers
- You can have fine-grained control over Concurrency and scaling
- Lambda supports Code signing to increase security
- You have complete control over the networking environment used by Lambda
- You can configure Lambda to use EFS