View a markdown version of this page

AWS Lambda Event Functions (formerly Lambda functions) - AWS Lambda

AWS Lambda Event Functions (formerly Lambda functions)

Tip

Join Serverless experts for free hands-on workshops to learn how to build Serverless applications with best practices. Sign up for free serverless workshops on the AWS Experience website.

AWS Lambda Event Functions, formerly called Lambda functions, run your code in response to events from sources such as Amazon Simple Storage Service (Amazon S3), Amazon Simple Queue Service (Amazon SQS), and EventBridge, without the need to manage servers. A function receives an event, runs your handler, and returns a response. Functions scale up and down automatically with pay-per-use pricing. To get started, see Create your first function. For information about best practices, programming languages, tenant isolation, and tools for development and deployment, see the related topics below.

Note

Event Functions is the name for the original Lambda function type, and the Lambda console labels it Event function. The underlying resource is unchanged: the API operations (such as CreateFunction and Invoke), the AWS SDKs, the AWS CLI, and the AWS::Lambda::Function resource type still use function, so you don't need to change any code or configuration.

For pricing information, see AWS Lambda Pricing.

When to use Event Functions

You can use Event Functions for:

  • File processing: Process files automatically when uploaded to Amazon Simple Storage Service. See file processing examples for details.

  • Long-running workflows: Build stateful, multi-step workflows that can run for up to one year. See durable Lambda functions for details.

  • Database operations and integration examples: Respond to database changes and automate data workflows. See database examples for details.

  • Scheduled and periodic tasks: Run automated operations on a regular schedule using EventBridge. See scheduled task examples for details.

  • Stream processing: Process real-time data streams for analytics and monitoring. See Kinesis Data Streams for details.

  • Web applications: Handle web and API requests through Amazon API Gateway, Application Load Balancer, or Lambda function URLs. By default, each execution environment handles one request at a time. On Lambda Managed Instances, an execution environment handles multiple requests concurrently.

  • Mobile backends: Create secure API backends for mobile and web applications.

  • IoT backends: Handle web, mobile, IoT, and third-party API requests. See IoT for details.

To serve HTTP traffic directly from a standard web server, use Lambda Web Functions. For more information, see AWS Lambda Web Functions.

Event Functions and durable functions

Lambda functions run for up to 15 minutes per invocation by default and are ideal for event-driven tasks like processing API requests, handling file uploads, or responding to database changes. On Lambda Managed Instances, functions can run for up to 90 minutes for asynchronous and event source mapping (ESM) invocations. Durable functions extend this model for workloads that need to run longer and survive interruptions. They automatically checkpoint their progress so they resume reliably after failures, and they can run for up to one year when invoked asynchronously. Use durable functions when you need multi-step workflows, human-in-the-loop approvals, or coordination across services over extended periods.

How Lambda works

When using Lambda, you are responsible only for your code. Lambda runs your code on a high-availability compute infrastructure and manages all the computing resources, including server and operating system maintenance, capacity provisioning, automatic scaling, and logging.

Because Lambda is a serverless, event-driven compute service, it uses a different programming approach than traditional web applications. The following model illustrates how Lambda works:

  1. You write and organize your code in Lambda functions, which are the basic building blocks you use to create a Lambda application.

  2. You control security and access through Lambda permissions, using execution roles to manage what AWS services your functions can interact with and what resource policies can interact with your code.

  3. Event sources and AWS services trigger your Lambda functions, passing event data in JSON format, which your functions process (this includes event source mappings).

  4. Lambda runs your code with language-specific runtimes (like Node.js and Python) in execution environments that package your runtime, layers, and extensions.

Tip

To learn how to build serverless solutions, check out the Serverless Developer Guide.

Key features

Configure, control, and deploy secure applications:

  • Environment variables modify application behavior without new code deployments.

  • Versions safely test new features while maintaining stable production environments.

  • Layers optimize code reuse and maintenance by sharing common components across multiple functions.

  • Code signing enforce security compliance by ensuring only approved code reaches production systems.

Scale and perform reliably:

  • Concurrency and scaling controls precisely manage application responsiveness and resource utilization during traffic spikes.

  • SnapStart significantly reduce cold start times. Lambda SnapStart can provide as low as sub-second startup performance, typically with no changes to your Event Function code.

  • Response streaming optimize function performance by delivering large payloads incrementally for real-time processing.

  • Container images package functions with complex dependencies using container workflows.

Connect and integrate seamlessly:

  • VPC networks secure sensitive resources and internal services.

  • File systems integration that shares persistent data and manage stateful operations across function invocations.

  • Function URLs create public-facing APIs and endpoints without additional services.

  • Extensions augment functions with monitoring, security, and operational tools.

Related information