A fully serverless CRUD API built with AWS Lambda, API Gateway, and DynamoDB.
This project demonstrates the power and efficiency of a serverless architecture on AWS. I built a complete CRUD (Create, Read, Update, Delete) API for a simple to-do list application. The entire stack—from the API endpoint to the database—is managed without a single server, which means it's highly scalable, cost-effective, and requires minimal maintenance.
The infrastructure for the API Gateway, Lambda functions, and DynamoDB table was provisioned entirely with **Terraform modules**, ensuring the entire setup is easily reproducible and version-controlled.
API Gateway → Lambda Functions → DynamoDB (provisioned with Terraform)
module "lambda_create" {
source = "./modules/lambda"
function_name = "create_todo"
handler = "create_todo.lambda_handler"
role_arn = aws_iam_role.lambda_role.arn
source_path = "./lambda_src/create_todo.zip"
}
def lambda_handler(event, context):
body = json.loads(event.get("body", "{}"))
task = body.get("task")
if not task:
return { "statusCode": 400, "body": json.dumps({"error":"Task required"}) }
# Store in DynamoDB
To test the API, you can use `cURL` from your terminal. Replace `<id>` with the actual todo ID returned from the `POST` request.
curl -X POST https://x6y1oxp1zb.execute-api.us-east-1.amazonaws.com/todos \
-H "Content-Type: application/json" \
-d '{"task":"learn terraform"}'
curl https://x6y1oxp1zb.execute-api.us-east-1.amazonaws.com/todos/<id>
curl -X PUT https://x6y1oxp1zb.execute-api.us-east-1.amazonaws.com/todos/<id> \
-H "Content-Type: application/json" \
-d '{"done": true}'
curl -X DELETE https://x6y1oxp1zb.execute-api.us-east-1.amazonaws.com/todos/<id>
You can view the full source code for this project on my GitHub repository.
View on GitHub →