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 HTTP requests via Amazon API Gateway, modifications to objects in Amazon S3 buckets, table updates in Amazon DynamoDB, and state transitions in AWS Step Functions.
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.
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 natively supports Java, Go, PowerShell, Node.js, C#, Python, and Ruby code, and provides a Runtime API which allows you to use any additional programming languages to author your functions.
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.
Package and deploy functions as container images
AWS Lambda supports packaging and deploying functions as container images, making it easy for customers to build Lambda based applications by using familiar container image tooling, workflows, and dependencies. Customers also benefit from the operational simplicity, automatic scaling with sub-second startup times, high availability, native integrations with 140 AWS services, and pay for use billing model offered by AWS Lambda. Enterprise customers can use a consistent set of tools with both their Lambda and containerized applications for central governance requirements such as security scanning and image signing.
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.
Connect to relational databases
Use Amazon RDS Proxy to take advantage of fully managed connection pools for 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. Currently, RDS Proxy offers support for MySQL and Aurora. You can use RDS Proxy for your serverless applications through the Amazon RDS console or through the AWS Lambda console.
Fine grained control over performance
Provisioned Concurrency gives you greater control over the performance of your serverless application. When enabled, Provisioned Concurrency keeps functions initialized and hyper-ready to respond in double-digit milliseconds. Provisioned Concurrency is ideal for any application built using AWS Lambda that needs greater control over function start time. You can easily configure the appropriate amount of concurrency that your application needs. You can increase the level of concurrency during times of high demand and lower it, or turn it off completely, when demand decreases. Taking advantage of Provisioned Concurrency requires no changes to your code. Provisioned Concurrency is an efficient way to achieve consistent performance for latency-sensitive applications as you need it, without having to manage compute resources.
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.
Run code in response to Amazon CloudFront requests
With Lambda@Edge, AWS Lambda can run your code across AWS locations globally in response to Amazon CloudFront events, such as requests for content to or from origin servers and viewers. This makes it easier to deliver richer, more personalized content to your end users with lower latency. Learn more »
Orchestrate multiple functions
You can coordinate multiple AWS Lambda functions for complex or long-running tasks by building workflows with AWS Step Functions. Step Functions lets you define workflows that trigger a collection of Lambda functions using sequential, parallel, branching, and error-handling steps. With Step Functions and Lambda, you can build stateful, long-running processes for applications and backends.
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.
Trust and integrity controls
Code Signing for AWS Lambda offers trust and integrity controls which allow you to verify that only unaltered code published by approved developers is deployed in your Lambda functions. You simply create digitally signed code artifacts and configure your Lambda functions to verify the signatures at deployment. This helps increase the speed and agility of your development, even within large development teams, while enforcing high security standards.
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.
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 integrate security agents within Lambda’s execution environment, all with no operational overhead and minimal impact to the performance of your functions.