Your First AWS Lambda Function

Lambda is the simplest cloud compute. From zero to a callable function.

Step 1: Write the function

def handler(event, context):
    return {"statusCode": 200, "body": "hello"}

Save as app.py.

Step 2: Deploy via SAM

Step 3: Invoke

Invocation is where the abstraction proves itself. The same function answers HTTP, scheduled events, and queue triggers depending on the wiring.

Step 4: Logs and monitoring

CloudWatch is the default observability surface for Lambda. Built-in metrics cover invocation health; custom metrics cover the business logic.

Antipatterns

What to do this week

Three moves. (1) Run the tutorial end-to-end on your own laptop / sandbox. (2) Apply the pattern to one production workload. (3) Document the variations you needed; share with the team.