
π Introduction
Welcome to my comprehensive guide on building a Serverless CRUD Application using AWS! In this post, we'll dive deep into how to create and deploy a fully serverless, scalable, and cost-effective CRUD system using a variety of AWS services. Whether you're a developer eager to explore serverless architectures or looking for a rapid prototyping solution, this guide is for you! π
Follow the GitHub Documentation and code for full implementation details:
πΉ GitHub Repo: serverless-crud-app
Table of Contents
About the Project π
The Serverless CRUD App is a complete backend and frontend solution that leverages a fully serverless architecture to manage Create, Read, Update, and Delete operations. Built with AWS SAM, CloudFormation, and a structured backend API, this project seamlessly integrates with a simple HTML/JavaScript frontend hosted on Amazon S3.
Why build a Serverless CRUD App?
Scalability: Automatically scales based on demand.
Cost-Effective: Pay only for what you use.
Simplicity: Focus on business logic instead of server maintenance.
High Availability: AWS services ensure robust, fault-tolerant operations.
When is this useful?
Rapid prototyping of applications.
Developing low to medium traffic apps.
Optimizing costs for intermittent workloads.
Architectural FlowποΈ
The app is built on a modern AWS serverless stack. Here's an architectural overview:


Key Components:
Frontend (S3): Hosts the static HTML, CSS, and JS.
API Gateway: Exposes RESTful endpoints for CRUD operations.
Lambda Functions: Execute CRUD logic and handle API requests.
DynamoDB: NoSQL database storing items (e.g.,
id,name,age).
Frontend UI

Project Structure π
serverless-crud-app/
βββ backend/
β βββ create/ # Lambda function for creating resources
β βββ read/ # Lambda function for reading a single resource
β βββ update/ # Lambda function for updating resources
β βββ delete/ # Lambda function for deleting resources
β βββ list/ # Lambda function for listing resources
β βββ documentations/ # Detailed API and infrastructure docs
βββ frontend/
β βββ index.html # Static frontend UI
βββ pipelines/ # CI/CD pipeline configurations
βββ cloudformation.yaml # CloudFormation/SAM stack configuration
βββ template.yaml # AWS SAM template definition
βββ README.md # Project documentation
backend/: Contains all Lambda function code and documentation.
frontend/: Hosts the static UI assets.
pipelines/: Holds configurations for automated CI/CD deployments.
cloudformation.yaml / template.yaml: Define the AWS infrastructure as code.
README.md: Provides an overview and detailed documentation for the project.
Prerequisites & Setup π οΈ
Before you begin, ensure you have:
AWS Account: Required to deploy AWS resources.
AWS CLI: Installation Guide and configure with
aws configure.AWS SAM CLI / CloudFormation: For packaging and deploying the serverless application.
Node.js / Python: For frontend and backend development/testing.
Documentations π
Additional documentation files can be found in the documentations/ directory:
Detailed Workflow π
User Accesses the Frontend:
The user opens the static site hosted on Amazon S3 (optionally via CloudFront).User Chooses a CRUD Operation:
Create: Fill out ID, Name, and Age fields.
Read: Enter an ID to fetch details.
Update: Enter an ID along with fields to update.
Delete: Enter an ID to remove an item.
List: Retrieve all items from the DynamoDB table.
Request Routing via API Gateway:
The frontend sends an HTTP request to API Gateway, which routes it to the appropriate Lambda function.Lambda Function Processing:
The Lambda function performs the CRUD operation on the DynamoDB table and returns a JSON response.Response Displayed on the Frontend:
The result (success or error) is displayed to the user in the UI.
CRUD Operations βοΈ
Create (POST /create):
Frontend: Sends an array of items (e.g.,
[{ id, name, age }, ...]).Lambda: Inserts each item into DynamoDB using
put_item.
Read (GET /read?id=123):
Frontend: Appends
?id=123to the URL.Lambda: Retrieves an item using
get_item(Key={"id": ...}).
Update (PUT /update):
Frontend: Sends a JSON payload with
idand fields to update.Lambda: Uses
update_itemwith dynamic update expressions.
Delete (DELETE /delete):
Frontend: Sends a JSON payload with
"Key": { "id": "..." }.Lambda: Calls
delete_item(Key={"id": ...}).
List (GET /list):
Frontend: Issues a GET request to retrieve all items.
Lambda: Scans or queries the DynamoDB table to list items.
Deployment & Configuration π
CloudFormation / AWS SAM:
Run:sam build && sam deploy --guidedThis command deploys your backend resources, including Lambda functions, DynamoDB, and API Gateway.
S3 Frontend Hosting:
Upload your
frontend/index.html(and assets) to an S3 bucket.Enable Static Website Hosting on the bucket.
Optionally, configure CloudFront for better global distribution.
Environment Variables:
SetTABLE_NAMEin your Lambda configuration to the name of your DynamoDB table.CORS Configuration:
Ensure each Lambda response includesAccess-Control-Allow-Origin: *. API Gateway should be configured with Lambda Proxy Integration to pass these headers through.
AWS Services Used π
This project leverages several key AWS services:
AWS S3: For hosting the static frontend.
Amazon API Gateway: To expose RESTful endpoints.
AWS Lambda: For executing backend CRUD logic.
AWS CloudFormation / SAM: For defining and deploying infrastructure as code.
Amazon DynamoDB: As a scalable NoSQL database.
AWS CloudWatch: For logging and monitoring.
AWS X-Ray: For tracing and debugging Lambda invocations.
AWS IAM: To securely manage permissions and roles.
AWS CloudFront: For global content delivery (optional).
AWS Cognito: (Optional) For user authentication and authorization if needed.
POSTMAN
Features β¨
π οΈ Serverless Backend: Leverages AWS Lambda to handle CRUD operations.
π Infrastructure as Code: Built with AWS SAM and CloudFormation templates.
π¨ Modern Frontend UI: A simple HTML/JavaScript interface for interacting with the backend.
π CI/CD Pipelines: Automated deployments via AWS CodePipeline or GitHub Actions.
π Comprehensive Documentation: Detailed API docs, testing guides, and architecture overviews.
Local Testing π§ͺ
Using Postman:
Create:
POST /createwith JSON body:{"items": [{"id":"123","name":"Test","age":25}]}Read:
GET /read?id=123Update:
PUT /updatewith JSON body:{"id":"123","name":"NewName","age":30}Delete:
DELETE /deletewith JSON body:{"Key":{"id":"123"}}List:
GET /list
CloudWatch Logs:
Use CloudWatch to monitor Lambda logs and debug issues.
Contributing π€
Contributions are welcome! Hereβs how you can contribute:
Fork & Clone: Fork the repository on GitHub and clone it locally.
Create a Feature Branch:
git checkout -b feature/my-awesome-featureCommit & Push: Make your changes, commit, and push them to your fork.
Open a Pull Request: Provide detailed descriptions of your changes and open a PR against the
mainbranch.
For additional guidelines, please refer to the CONTRIBUTING.md file.
License π
This project is licensed under the MIT License.
Author π¨βπ»
Created and maintained by Praful Patel.
Additional Resources π
Happy Building!
If you have any questions or need further details, feel free to open an issue on GitHub or reach out directly.
About the author
PRAFUL PATEL βοΈπ, Highly skilled and motivated Cloud Engineer with a proven track record of designing, implementing, and managing robust cloud infrastructure solutions. With years of hands-on experience, I am deeply passionate about creating scalable and resilient cloud architectures that drive innovation and deliver optimal business outcomes. π Key Competencies:
Cloud Platforms: AWS, Azure, GCP, OCI Infrastructure as Code: Terraform, Ansible Containers & Orchestration: Docker, Kubernetes Scripting: Python, Bash/Shell CI/CD & Version Control: GitHub, Jenkins, CircleCI Monitoring & Analytics: Grafana, Prometheus, Datadog, New Relic Backup & Recovery: Veeam Operating Systems: Linux, Windows DevOps Tools: AWS Code Build, Code Pipeline, Azure DevOps
π Continuous Learning: Staying ahead in the rapidly evolving cloud landscape is my priority. I am committed to expanding my skill set and embracing emerging cloud technologies to drive efficiency and innovation. Passionate Cloud/DevOps enthusiast dedicated to designing, building, and deploying cutting-edge technology solutions. As a devoted YouTuber, I love sharing insights through informative videos and crafting technical blogs that delve into areas like βοΈ Cloud, π οΈ DevOps, π§ Linux, and π¦ Containers. π» Open Source Advocate: Contributing to open-source projects is a vital part of my journey. I actively engage in projects centered around Cloud, DevOps, Linux, and Containers, fostering collaboration and innovation within the community. π Let's Connect: I am enthusiastic about virtual collaborations and meeting fellow professionals. Let's explore how I can contribute to your organization's cloud goals. Feel free to connect or DM me.
π Portfolio: Check out my portfolio π LinkedIn: Connect on LinkedIn π οΈ GitHub: Explore my projects π₯ YouTube: Watch my videos π Medium: Read my articles π Dev.to: Check out my posts
Comments
Join the discussionNo comments yet. Be the first to comment.
AWS Projects
π₯ **AWS Cloud Hands-On Projects**: Elevate Your Skills with Real-World Experience π Dive into a world of cloud mastery as we explore captivating projects that fuse cutting-edge technology with hands




