This project demonstrates how to build a fully serverless, scalable, and pay-per-use CRUD REST API using AWS Lambda, Amazon API Gateway, and Amazon DynamoDB.
It supports Create, Read, Update, and Delete operations, all triggered through API endpoints.
- AWS Lambda – Serverless compute for executing backend logic.
- Amazon API Gateway – To expose RESTful API endpoints.
- Amazon DynamoDB – NoSQL database for storing data.
- AWS IAM – To manage secure permissions for Lambda.
- Amazon CloudWatch – For logging and monitoring.
- Amazon SNS – For alert notifications.
Client (Postman / Browser)
↓
API Gateway (REST Endpoints)
↓
AWS Lambda (CRUD Functions)
↓
DynamoDB (ItemsTable)
↓
CloudWatch (Logs & Metrics)
Below is the exact workflow I followed to build this project from scratch:
- Go to AWS Console → DynamoDB → Create Table
- Table name:
ItemsTable - Partition key:
id(String) - Keep other settings as default (On-Demand capacity)
- Click Create Table
Result:- DynamoDB table ready to store items.
- Go to IAM → Roles → Create Role
- Trusted entity type: AWS Service
- Use case: Lambda
- Attach policies:
AmazonDynamoDBFullAccessCloudWatchFullAccess
- Name the role:
LambdaDynamoDBRole - Click Create Role
Result:- A secure role with DynamoDB & CloudWatch permissions created.
We created 4 Lambda functions, one for each CRUD operation.
| Function Name | Purpose | Operation |
|---|---|---|
CreateItemFunction |
Adds a new item to DynamoDB | POST /items |
GetItemsFunction |
Retrieves all items | GET /items |
UpdateItemFunction |
Updates an existing item | PUT /items/{id} |
DeleteItemFunction |
Deletes an item by ID | DELETE /items/{id} |
Each Lambda uses Python (boto3) to interact with DynamoDB.
Result:- All Lambda functions tested successfully inside AWS Lambda Console.
- Go to API Gateway → Create API → REST API
- Create a new Resource named
/items - Under
/items, create the following Methods:POST→ Integrate withCreateItemFunctionGET→ Integrate withGetItemsFunction
- Create another resource
/items/{id}PUT→ Integrate withUpdateItemFunctionDELETE→ Integrate withDeleteItemFunction
- Enable Lambda Proxy Integration for all.
Result: API Gateway connected with all Lambda functions.
-
Go to Actions → Deploy API
-
Create a new stage named prod
-
Copy the Invoke URL, e.g.:
https://<api-id>.execute-api.<region>.amazonaws.com/prod
Result: Public API endpoints are now live and callable from Postman.
Use the following endpoints:
| Method | Endpoint | Description | Example Body |
|---|---|---|---|
| POST | /items |
Create an item | { "name": "Test Item", "description": "Created via Postman" } |
| GET | /items |
Read all items | — |
| PUT | /items/{id} |
Update an item | { "name": "Updated Item", "description": "Modified" } |
| DELETE | /items/{id} |
Delete an item | — |
Result: All CRUD operations returned correct responses and updated DynamoDB successfully.
Monitoring and alerting are crucial for production-grade systems. Below are the exact steps I followed to enable logging, monitoring, and alert notifications for my Lambda functions.
Every Lambda automatically sends logs to CloudWatch, but let’s confirm and check them.
- Go to AWS Console → Lambda → your function (e.g., CreateItemFunction)
- Scroll down to Monitor → View logs in CloudWatch
- You’ll see a log group like:
/aws/lambda/CreateItemFunction - Inside this log group, you can open individual Log Streams to view:
- Start and end time of Lambda invocation
- Any
print()orconsole.log()outputs - Error messages if Lambda failed
Result:
Lambda is already logging to CloudWatch automatically.
Now let’s turn those logs into alerts.
This will send me an email when Lambda fails (e.g., due to an exception or timeout).
- Go to AWS Console → SNS → Topics → Create Topic
- Choose Standard type
- Name it something like:
LambdaErrorAlerts - Click Create topic
- After creating the topic → Click on it → Create Subscription
- Protocol →
Email - Endpoint → Enter your email address (the one you want alerts on)
- Check your inbox and click Confirm subscription
Once confirmed, the status will show as Confirmed in the SNS dashboard.
- Go to AWS Console → CloudWatch → Alarms → All Alarms → Create alarm
- Choose Select metric
- Choose:
Lambda Metrics → By Function Name → <YourFunctionName> → Errors - Click Select metric
- Under Conditions, set:
- Threshold type → Static
- Whenever
Errorsis ≥ 1 for 1 datapoint
- Under Actions → Alarm state trigger → In Alarm, select:
- Send a notification to → LambdaErrorAlerts
- Give it a name:
LambdaErrorAlarm-CreateItemFunction - Click Create Alarm
We can repeat this for your other functions too(Get, Update, Delete).
Final Result:
The system now automatically sends email alerts whenever any Lambda function fails.
- 100% Serverless (no servers or EC2 required)
- Pay-per-use pricing
- Scalable CRUD API
- Clean IAM-based security
- Tested with Postman
- Observable with CloudWatch
- Gained hands-on experience with AWS Lambda and API Gateway integration
- Learned to manage IAM roles & permissions effectively
- Understood DynamoDB CRUD operations using boto3
- Practiced API testing with Postman
- Created a scalable, production-ready serverless system
⭐ If you found this project helpful, give it a star!