Revisit Amazon Web Services re:Invent 2024’s biggest moments and watch keynotes and innovation talks on demand
Amazon 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 Amazon Lambda to extend other Amazon Web Services services with custom logic, or create your own back-end services that operate at Amazon Web Services scale, performance, and security. Amazon 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 Amazon Lambda functions
The code you run on Amazon 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 Amazon Lambda, you can associate your function with specific Amazon Web Services 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 request
Key Product Features
Extend other Amazon Web Services services with custom logic
Amazon Lambda allows you to add custom logic to Amazon Web Services 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 Amazon 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 Amazon Identity and Access Management (IAM) role. Then, you specify the Amazon Web Services 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 Amazon 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
Amazon 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. Amazon 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. Amazon 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 Amazon Lambda and the functions running on the service provide predictable and reliable operational performance. Amazon 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.
Automatic scaling
Amazon 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. Amazon 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
Amazon Lambda allows your code to securely access other Amazon Web Services services through its built-in Amazon SDK and integration with Amazon Identity and Access Management (IAM). Amazon Lambda runs your code within a VPC by default. You can optionally also configure Amazon 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 Amazon Lambda, there are no new languages, tools, or frameworks to learn. You can use any third party library, even native ones. Amazon 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 Amazon 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 Amazon Lambda Pricing.
Flexible resource model
You choose the amount of memory you want to allocate to your functions and Amazon Lambda allocates proportional CPU power, network bandwidth, and disk I/O.
Connect to shared file systems
With Amazon Elastic File System for Amazon 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
Amazon 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.
Access to a secure, low-latency ephemeral file system
Amazon Lambda customers can configure up to 10,240 MB of ephemeral storage for their Lambda functions. For data intensive applications such as machine learning inference, financial computations, and media processing, customers often need to read and write large amounts of data to ephemeral storage. The Amazon Lambda execution environment provides an ephemeral file system for customers’ code to access via /tmp space, which is preserved for the lifetime of the execution environment, and can provide a transient cache for data between invocations. You can configure ephemeral storage (/tmp) between 512 MB and 10,240 MB. You can control the amount of ephemeral storage a function gets for reading or writing data, allowing you to use Amazon Lambda for ETL jobs, ML inference, or other data-intensive workloads.
Learn more about Amazon Lambda pricing
Intended Usage and Restrictions
Your use of this service is subject to the Amazon Web Services Customer Agreement.