AWS Lambda is a serverless compute service that runs your code in response to events and automatically manages the underlying compute resources for you. You can use AWS Lambda to extend other AWS services with custom logic, or create your own back-end services that operate at AWS scale, performance, and security. AWS Lambda can automatically run code in response to multiple events, such as modifications to objects in Amazon S3 buckets or table updates in Amazon DynamoDB.
Lambda runs your code on high-availability compute infrastructure and performs all the administration of the compute resources, including server and operating system maintenance, capacity provisioning and automatic scaling, code and security patch deployment, and code monitoring and logging. All you need to do is supply the code.
Introducing AWS Lambda functions
The code you run on AWS Lambda is called a “Lambda function.” After you create your Lambda function it is always ready to run as soon as it is triggered, similar to a formula in a spreadsheet. Each function includes your code as well as some associated configuration information, including the function name and resource requirements. Lambda functions are “stateless,” with no affinity to the underlying infrastructure, so that Lambda can rapidly launch as many copies of the function as needed to scale to the rate of incoming events.
After you upload your code to AWS Lambda, you can associate your function with specific AWS resources (e.g. a particular Amazon S3 bucket, Amazon DynamoDB table, Amazon Kinesis stream, or Amazon SNS notification). Then, when the resource changes, Lambda will execute your function and manage the compute resources as needed in order to keep up with incoming requests.
Key Product Features
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.
It is easy to get started with AWS Lambda. First you create your function by uploading your code (or building it right in the Lambda console) and choosing the memory, timeout period, and AWS Identity and Access Management (IAM) role. Then, you specify the AWS resource to trigger the function, either a particular Amazon S3 bucket, Amazon DynamoDB table, or Amazon Kinesis stream. When the resource changes, Lambda will run your function and launch and manage the compute resources as needed in order to keep up with incoming requests.
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. By using Lambda to process custom events instead of servicing these on the client, you can avoid client platform variations, reduce battery drain, and enable easier updates.
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. With Lambda, you never have to update the underlying OS when a patch is released, or worry about resizing or adding new servers as your usage grows. AWS Lambda seamlessly deploys your code, does all the administration, maintenance, and security patches, and provides built-in logging and monitoring through Amazon CloudWatch.
Built-in fault tolerance
Lambda has built-in fault tolerance. AWS Lambda maintains compute capacity across multiple Availability Zones in 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.
AWS Lambda invokes your code only when needed and automatically scales to support the rate of incoming requests without requiring you to configure anything. There is no limit to the number of requests your code can handle. AWS Lambda typically starts running your code within milliseconds of an event, and since Lambda scales automatically, the performance remains consistently high as the frequency of events increases. Since your code is stateless, Lambda can start as many instances of it as needed without lengthy deployment and configuration delays.
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). AWS Lambda runs your code within a VPC by default. You can optionally also configure AWS Lambda to access resources behind your own VPC, allowing you to leverage custom security groups and network access control lists to provide your Lambda functions access to your resources within a VPC.
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. AWS Lambda supports Java, Node.js, C#, and Python code, with support for other languages coming in the future.
Fine grained control over performance
Provisioned Concurrency gives you greater control over the performance of your apps. When enabled, Provisioned Concurrency keeps functions initialized and hyper-ready to respond in double-digit milliseconds, up to the provisioned concurrency level. Provisioned Concurrency is ideal for any service built using Lambda that needs greater control over function start times. You can easily provision the appropriate amount of concurrency based on your application's unique demand. Provisioned Concurrency can be increased during times of high demand and lowered, or completely turned off, when demand decreases. Taking advantage of Provisioned Concurrency requires no changes to your existing code.
Only pay for what you use
With AWS Lambda, you pay for execution duration rather than by server unit. When using Lambda functions, you only pay for requests served and the compute time required to run your code. Billing is metered in increments of 1 millisecond, making it cost-effective and easy to scale automatically from a few requests per day to thousands per second. With Provisioned Concurrency, you pay for the amount of concurrency that you configure and for the period of time that you configure it. When Provisioned Concurrency is enabled for your function and you execute it, you also pay for requests and execution duration. To learn more about pricing, please visit AWS Lambda Pricing.
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.
Connect to shared file systems
With Amazon Elastic File System for AWS Lambda, you can securely read, write, and persist large volumes of data at low latency, at any scale. You don't need to write code to download data to temporary storage in order to process it. This saves time and simplifies the code, enabling you to focus on your business logic. EFS for Lambda is ideal for building machine learning applications or loading large reference files or models, processing or backing up large amounts of data, hosting web content, or sharing files between serverless applications and instance or container based applications.
Integrate Lambda with your favorite operational tools
AWS Lambda Extensions allow you to easily integrate Lambda with your favorite tools for monitoring, observability, security, and governance. Lambda Extensions run within Lambda’s execution environment which is where your function code is executed. With Lambda extensions you can capture fine grained diagnostic information and send function logs, metrics, and traces to a location of your choice. You can also run security agents within Lambda’s execution environment, all with no operational overhead and minimal impact to the performance of your functions.