# Lambda Basics — AWS Fundamentals: Core Services for Cloud Beginners

Source: https://www.skillbyai.com/en/aws/aws-lambda-basics

> Run code on events without managing servers using AWS Lambda functions and pay only per invocation.

## What Lambda is

**Lambda** runs your code in response to events, without you provisioning or managing any server. You pay only for the milliseconds your function actually runs.

## Triggers & use cases

Lambda functions can be triggered by an S3 upload, an API Gateway request, a schedule, a queue message, and more — great for image processing, APIs, and glue code between services.

## A minimal handler

The function signature Lambda invokes for each event.

```python
def handler(event, context):
    name = event.get("name", "world")
    return {"statusCode": 200, "body": f"Hello, {name}!"}
```

Output:

```
{"statusCode": 200, "body": "Hello, world!"}
```

## An on-call worker

Lambda is like an on-call worker who appears the instant a task arrives, does exactly that job, then leaves — you're never paying them to sit around idle between calls.
