Serverless To-do API 📋

A fully serverless CRUD API built with AWS Lambda, API Gateway, and DynamoDB.

🔍 Overview

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.

🏛️ Architecture

Serverless Todo API Architecture

API Gateway → Lambda Functions → DynamoDB (provisioned with Terraform)

🧑🏻‍💻 Code Snippets

Terraform Module Example


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"
}
                    

Python Lambda Handler Example


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
                    

Try the API

To test the API, you can use `cURL` from your terminal. Replace `<id>` with the actual todo ID returned from the `POST` request.

Create:

curl -X POST https://x6y1oxp1zb.execute-api.us-east-1.amazonaws.com/todos \
-H "Content-Type: application/json" \
-d '{"task":"learn terraform"}'

Read:

curl https://x6y1oxp1zb.execute-api.us-east-1.amazonaws.com/todos/<id>

Update:

curl -X PUT https://x6y1oxp1zb.execute-api.us-east-1.amazonaws.com/todos/<id> \
-H "Content-Type: application/json" \
-d '{"done": true}'

Delete:

curl -X DELETE https://x6y1oxp1zb.execute-api.us-east-1.amazonaws.com/todos/<id>

Skills Demonstrated

  • Terraform (IaC, modular design)
  • Serverless architecture (AWS Lambda + API Gateway)
  • DynamoDB (NoSQL database)
  • Python backend development
  • AWS IAM & permissions management

Source Code

You can view the full source code for this project on my GitHub repository.

View on GitHub →