Serverless
AWS Lambda
Run code without provisioning servers.
Official docsOverview
Lambda runs your code in response to events (HTTP, queue messages, file uploads, schedules). You pay per invocation and GB-seconds of execution; no servers to patch.
When to use it
- Event-driven glue code between AWS services
- Lightweight APIs behind API Gateway
- Scheduled jobs (cron via EventBridge)
- Short-lived test helpers and webhooks
Setup
- Console → Lambda → Create function. Choose runtime (Node 20, Python 3.12, etc).
- Define an execution role (IAM) with least-privilege policies.
- Set memory (128 MB – 10 GB) and timeout (max 15 min).
- Add a trigger (API Gateway, S3, SQS, EventBridge…).
- Optionally enable VPC access if calling private resources.
How to use
Minimal Node.js handler
export const handler = async (event) => {
return { statusCode: 200, body: JSON.stringify({ ok: true, event }) };
};Deploy with AWS CLI
zip -r fn.zip index.mjs
aws lambda update-function-code --function-name my-fn --zip-file fileb://fn.zipQA use cases
- Webhook receiver that posts CI results into Slack / Teams.
- On S3 upload of a test report, generate a summary and email QA leads via SES.
- Scheduled API health-check that pings endpoints and writes pass/fail metrics to CloudWatch.
