Amazon Lambda -- Serverless Secrets Revealed !
Hey Guys,
Mohsin here!!!
Welcome back to my YouTube channel.
Today we are going to deep dive on one of my favorite AWS Service i.e.
AWS Lambda :)
AWS Lambda is a Serverless compute service offered by Amazon Web Services (AWS).
Enables us to run the code without provisioning or managing servers. We can simply upload the code, and Lambda takes care of everything else, from launching infrastructure to scaling resources.
Primarily designed for tasks such as handling image and object upload to Amazon S3 , updating DynamoDB tables, responding to website clicks and reacting to sensor readings from IoT connected devices.
AWS Lambda function is used in event-driven architecture where lambda gets triggered in response of an event such as a file uploaded to S3 bucket etc.
Can also be used to automatically provision back-end services triggered by custom HTTP requests, and stop such services when not in use to save resources. These custom HTTP requests are configured in AWS API Gateway, which can handle authentication and authorization in conjunction with AWS Cognito.
Unlike Amazon EC2, which is priced by the hour but metered by the second, AWS Lambda is metered by rounding up to the nearest millisecond with no minimum execution time.
AWS Lambda scales automatically in response to demand changes with respect to incoming traffic.
** Benefits of AWS Lambda **
Reduced operational overhead: Run code without provisioning or managing servers, creating workload-aware cluster scaling logic, maintaining event integrations, or managing runtimes.
Increased agility: Run code for virtually any type of application or backend service. Just upload the code as a ZIP file or container image, and Lambda automatically allocates compute execution power and runs the code based on the incoming request or event, for any scale of traffic.
Pay-per-use pricing: Only pay for the compute time code takes to run, leading to cost-efficiency for event-driven and short-lived tasks.
Automatic scaling: Lambda automatically scales up and down to meet the workload demands, ensuring high availability and avoiding idle resources.
Integration with other AWS services: Seamlessly integrate the Lambda functions with AWS services like S3, SNS, and DynamoDB for powerful backend capabilities.
** Use cases of AWS Lambda **
Serverless APIs:
Build and deploy HTTP APIs triggered by events like HTTP requests, S3 object uploads, or scheduled events.
Data processing:
Analyze data streams, transform images, and trigger analytics pipelines in real-time.
Chatbots and voice assistants:
Create interactive chatbots and voice assistants responding to user interactions.
Background tasks:
Automate tasks like sending emails, generating reports, and cleaning up resources.
Internet of Things (IoT):
Process sensor data, control devices, and trigger actions based on real-time events
** Key limitations of AWS Lambda **
Execution Time:
Maximum execution timeout of 15 minutes. Hence we need to consider using lambda in the architecture that needs it to run for longer duration.
Cold Starts:
Initial latency for first invocation: When a function hasn't been used recently, it may take time to spin up a container, leading to delays in response time. This can be mitigated through techniques like provisioned concurrency or keeping functions warm
Resource Limits:
Memory: Maximum of 10,240 MB (configurable), constraining memory-intensive workloads.
Disk space: Ephemeral storage capped at 512 MB, limiting file I/O operations.
Concurrent executions:
Default limit of 1000 per region, adjustable through a service quota request.
Cost Considerations:
Pay-per-use model: While cost-effective for short, infrequent executions, can become expensive for
high-volume or long-running functions.
Debugging and Monitoring:
Debugging can be challenging: Traditional debugging tools may not work seamlessly in the serverless environment.
Monitoring and logging vital: Proactive monitoring and logging are crucial for identifying and addressing issues in Lambda functions.
Deployment Package Size: 50 MB limit for direct uploads: For larger packages, consider deployment from Amazon S3.
Network Constraints:
No direct access to the internet: Functions must use VPCs or configured NAT gateways to access external resources, introducing complexity for network-dependent tasks.
** AWS Lambda Pricing **
Lambda is priced based on the allocated memory, execution time.
Please checkout the below url to see the lambda pricing in a specific region :
.https://aws.amazon.com/lambda/pricing/?
https://s3.amazonaws.com/lambda-tools...
I hope you will find this session useful to understand AWS Lambda Service.
Please leave your comments in the comments section below.
Dont forget to like,share,comments and subscribe to my YouTube channel.
Happy Learning :)