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.
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.
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.
Pay per use
With AWS Lambda you pay only for the requests served and the compute time required to run your code. Billing is metered in increments of 100 milliseconds, making it cost-effective and easy to scale automatically from a few requests per day to thousands per second.
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.