# AWS Lambda

> AWS Lambda runs your code in response to events without servers to manage, and you pay only for the time the code runs. It is the core of AWS serverless.

- Source: https://www.itwonderlab.com/aws-lambda/
- Published: 2026-10-05
- Updated: 2026-10-05
- Author: Javier Ruiz Jiménez (https://www.javierruizjimenez.com/)
- Site: IT Wonder Lab (https://www.itwonderlab.com/)

---

**AWS Lambda** is a serverless compute service: you upload a function and AWS runs it when an event happens, scaling from zero to thousands of parallel executions and charging only for the requests and the execution time. There are no servers, [AMIs](https://www.itwonderlab.com/aws-ami/) or operating systems to patch.

### Key concepts

- **Function**: the code with its handler, runtime (Python, Node.js, Java, .NET, Ruby, Go through custom runtimes or container images) and settings such as memory (from 128 MB to 10,240 MB, which also determines the CPU), timeout (up to 15 minutes) and environment variables.
- **Triggers (event sources)**: [API Gateway](https://www.itwonderlab.com/aws-api-gateway/), [S3](https://www.itwonderlab.com/aws-s3/) events, [SQS](https://www.itwonderlab.com/aws-sqs/) queues, [SNS](https://www.itwonderlab.com/aws-sns/) topics, [DynamoDB](https://www.itwonderlab.com/aws-dynamodb/) streams, EventBridge schedules, [CloudWatch](https://www.itwonderlab.com/aws-cloudwatch/) Logs and more. A function URL gives a function its own HTTPS endpoint.
- **Execution role**: the [IAM](https://www.itwonderlab.com/aws-iam/) role that gives the function permissions to call other AWS services.
- **Cold start**: the extra time to start a new execution environment. *Provisioned concurrency* and *SnapStart* reduce it.
- **Layers** share libraries between functions, **versions and aliases** allow controlled releases, and **concurrency limits** protect downstream systems.
- A function can run **inside a [VPC](https://www.itwonderlab.com/aws-vpc/)** to reach private resources such as [RDS](https://www.itwonderlab.com/aws-rds/) databases. It then needs a NAT Gateway for Internet access.
- Packages are deployed as a ZIP file (from [S3](https://www.itwonderlab.com/aws-s3/) or direct upload) or as a container image from [ECR](https://www.itwonderlab.com/aws-ecr/).

### Pricing

Per request and per execution time (GB-seconds, depending on the memory), plus a monthly free tier. See the [Lambda pricing](https://aws.amazon.com/lambda/pricing/).

### With Terraform

The resources are `aws_lambda_function`, `aws_lambda_permission`, `aws_lambda_event_source_mapping`, `aws_lambda_alias` and `aws_lambda_function_url`, plus the `aws_iam_role` for the execution role.

See also: [AWS ECS](https://www.itwonderlab.com/aws-ecs/) and [AWS Fargate](https://www.itwonderlab.com/aws-fargate/) for containers, [AWS Step Functions](https://aws.amazon.com/step-functions/) to orchestrate functions.
