AWS Serverless: Lambda, DynamoDB and API Gateway
Build a working REST API without any server management — using functions, a NoSQL database and a managed gateway.
AWS Serverless in Practice
Serverless means you don't manage servers. You upload code; AWS runs it when a request arrives.
The classic serverless trio
Client → API Gateway → Lambda → DynamoDB
- API Gateway — receives the HTTPS request and forwards it.
- Lambda — runs your function for a few milliseconds.
- DynamoDB — a fully-managed NoSQL database.
A tiny Lambda in Python
import json, boto3, uuid, os
table = boto3.resource("dynamodb").Table(os.environ["TABLE"])
def handler(event, _ctx):
body = json.loads(event["body"])
note = {"id": str(uuid.uuid4()), "title": body["title"]}
table.put_item(Item=note)
return {"statusCode": 200, "body": json.dumps(note)}
What you pay
- Lambda: first 1M requests + 400,000 GB-seconds free every month.
- DynamoDB: 25 GB storage free.
- API Gateway: 1M requests free for 12 months.
A personal-scale API is essentially free.
Beginner tips
- Cold starts — the first request after idle time may take ~500ms. Fine for background jobs, sometimes noticeable for user-facing APIs. Provisioned Concurrency or SnapStart fixes it.
- DynamoDB is NOT SQL — plan access patterns before designing the table (single-table design).
- Deploy with AWS SAM or Serverless Framework, not clickops.
Real-world example
TechNotesHub itself could be rebuilt fully serverless: static frontend on S3+CloudFront, API on Lambda + API Gateway, articles in DynamoDB. Running cost at 1,000 daily users: under $5/month.
Keep reading
You may also like
aws
AWS S3 Bucket Best Practices for Production
Ten field-tested rules for locking down, versioning and scaling S3 buckets in production workloads.
aws
Deploy a Container on AWS: Dockerfile → ECR → ECS Fargate
The complete story of getting a Docker container to run on AWS with zero servers to patch — starts here.
aws
Understanding IAM Roles vs Users vs Groups
A crisp mental model for AWS identity primitives — with common pitfalls.
Discussion (0)
No comments yet. Be the first to weigh in.