AWS Lambda lets you run code without provisioning or managing servers. You pay only for the compute time you consume – there’s no charge when your code isn’t running. Just upload your code and Lambda takes care of everything required to run and scale your code with high availability. You can set up your code to automatically trigger from other AWS services or call it directly from any web or mobile app.
The code is executed based on the response of events in AWS services such as adding/removing files in S3 bucket, updating Amazon dynamo dB tables, HTTP request from Amazon API gateway etc.
When using AWS Lambda, you are responsible only for your code. It manages the compute fleet that offers a balance of memory, CPU, network, and other resources.
Upload AWS lambda code in any of languages it supports, that is NodeJS, Java, Python, C# and Go.
These are few AWS services on which AWS lambda can be triggered. To know more on AWS Services, visit https://nerdyelectronics.com/cloud/aws-services
AWS Lambda has the uploaded code and the event details on which the trigger has occurred. For example, event from Amazon S3, Amazon API Gateway, Dynamo dB, Amazon SNS, Amazon Kinesis, CloudFront, CloudTrail etc can trigger Lambda function.
Executes AWS Lambda Code only when triggered by AWS services under the scenarios such as −
- User uploads files in S3 bucket
- http get/post endpoint URL is hit
- Data is added/updated/deleted in dynamo dB tables
- Push notification
- Data streams collection
- Hosting of website
- Email sending
Remember that AWS charges only when the AWS lambda code executes, and not otherwise.
Features of AWS Lambda
AWS Lambda provides a management console and API for managing and invoking functions.
Extend other AWS services with custom logic
AWS Lambda allows you to add custom logic to AWS resources such as Amazon S3 buckets and Amazon DynamoDB tables, making it easy to apply compute to data as it is enters or moves through the cloud.
Build custom back-end services
You can use AWS Lambda to create new back-end services for your applications that are triggered on-demand using the Lambda API or custom API endpoints built using Amazon API Gateway.
Bring your own code
With AWS Lambda, there are no new languages, tools or frameworks to learn. You can use any third party library, even native ones. You can also package any code (frameworks, SDKs, libraries, and more) as a Lambda Layer and manage and share them easily across multiple functions.
Lambda layers are a distribution mechanism for libraries, custom runtimes, and other function dependencies. Layers let you manage your in-development function code independently from the unchanging code and resources that it uses.
Completely automated administration
AWS Lambda manages all the infrastructure to run your code on highly available, fault-tolerant infrastructure, freeing you to focus on building differentiated back-end services.
Built-in fault tolerance
Lambda has built-in fault tolerance. AWS Lambda maintains compute capacity for each region to help protect your code against individual machine or data center facility failures. Both AWS Lambda and the functions running on the service provide predictable and reliable operational performance. AWS Lambda is designed to provide high availability for both the service itself and for the functions it operates. There are no maintenance windows or scheduled downtimes.
Lambda manages the infrastructure that runs your code, and scales automatically in response to incoming requests. When your function is invoked more quickly than a single instance of your function can process events, Lambda scales up by running additional instances. You only pay for the time that your function is initializing or processing events.
When you invoke a function, you can choose to invoke it synchronously or asynchronously.
With synchronous invocation, you wait for the function to process the event and return a response.
With asynchronous invocation, Lambda queues the event for processing and returns a response immediately. Also, Lambda handles retries if the function returns an error or is throttled.
Use concurrency settings to ensure that your production applications are highly available and highly responsive. To prevent a function from using too much concurrency, and to reserve a portion of your account’s available concurrency for a function, use reserved concurrency.
To enable functions to scale without fluctuations in latency, use provisioned concurrency.
Connect to relational databases
RDS Proxy efficiently manages thousands of concurrent database connections to relational databases, making it easy to build, highly scalable, secure, Lambda-based serverless applications that need to interact with relational databases.
Integrated security model
AWS Lambda allows your code to securely access other AWS services through its built-in AWS SDK and integration with AWS Identity and Access Management (IAM).
Only pay for what you use
When using Lambda functions, you only pay for requests served and the compute time required to run your code.
Flexible resource model
You choose the amount of memory you want to allocate to your functions and AWS Lambda allocates proportional CPU power, network bandwidth, and disk I/O.
I`ll write about how to create a lambda function in my next post.