Build a Serverless Feedback & Rating System Using AWS Lambda and DynamoDB

Utkarsh RastogiUtkarsh Rastogi
4 min read

Overview

In the modern digital environment, gathering user input in real time is essential to enhancing both the user experience and products. It can be expensive and time-consuming to manage backend infrastructure, which is frequently required for traditional feedback systems. With the help of this blog, you can create a scalable, affordable, and easily maintained serverless feedback and rating system on AWS.
This architecture enables users to provide ratings and comments instantaneously via a REST API by using AWS services like API Gateway, DynamoDB, and Lambda. The system can extract data for display in real-time dashboards or apps, processes new entries, and updates aggregate statistics like average rating and count. The design maintains precise and dynamic analytics without the need for human involvement by utilizing DynamoDB Streams and real-time event processing.

Solution Architecture

Key AWS Services Used

  • Amazon API Gateway – to expose HTTP endpoints

  • AWS Lambda – to process logic without managing servers

  • Amazon DynamoDB – to store feedback and statistics

  • DynamoDB Streams – to trigger processing logic on data changes

  • Amazon CloudWatch – for logs and monitoring

  • AWS IAM – to manage fine-grained permissionsSolution Architecture

Deployment Strategy (Using AWS CloudFormation)

To simplify and automate deployment, this project uses AWS CloudFormation—an Infrastructure as Code (IaC) tool that provisions all AWS resources in a consistent and repeatable way.

Why CloudFormation?

  • Repeatable deployments across environments (Dev, QA, Prod)

  • No manual configuration — just define everything in a YAML/JSON template

  • Easy to integrate into CI/CD pipelines

Core Flows Breakdown

1. Submitting Feedback (API + Storage)

  • The user submits feedback through an API endpoint.

  • This triggers a backend function that validates and stores the feedback data into the FeedbackTable in DynamoDB.

  • Each feedback record contains information like product ID, user ID, and rating and feedback comment.

2. Updating Rating Stats (Stream-Based Trigger)

  • When a new feedback item is inserted into FeedbackTable, it generates a DynamoDB Stream event.

  • This event triggers a second backend function, which processes the stream asynchronously.

  • The function reads the new feedback data and updates the aggregate rating statistics in another DynamoDB table, FeedbackRatingStatsTable.

  • It updates values like the sum of ratings, total count, and calculates the average rating for that product.

3. Deleting Feedback & Recalculating Stats

  • When a user deletes their feedback, the system removes the record from FeedbackTable.

  • This deletion also triggers a DynamoDB Stream event.

  • The stream processor recalculates the stats by subtracting the deleted rating and adjusting the average accordingly.

  • If no feedback remains for a product, the stats record is deleted.

4. Retrieving Feedback or Stats

  • Users or other systems can query APIs to retrieve:

    • Individual feedback entries for a product.

    • Aggregated rating statistics like average rating and total number of feedbacks.

Explore the Full Project Source Code

https://github.com/Utkarshlearner/serverless-feedback-system

Testing the System

submitfeedback

FeedbackTable

FeedbackRatingStatsTable

getratingsummary

getfeedback

deletefeedback

After Deletion Automatically Updated Stats Table

Conclusion

This serverless rating and feedback system demonstrates how AWS services such as Lambda, DynamoDB, API Gateway, and DynamoDB Streams can be integrated to produce a scalable, reasonably priced solution that requires little infrastructure management. Stream-based triggers are used to update rating statistics in real-time, and feedback is submitted over an API and stored in DynamoDB. Because of its support for real-time analytics, automatic scaling, and clean logic separation, the architecture is perfect for contemporary applications that demand backend functionality that is both powerful and lightweight. This project is easily extensible for a range of feedback-driven use cases and is completely reproducible when deployed using CloudFormation.


"Thank you for reading! If you found this blog helpful, don't forget to subscribe and follow for more insightful content. Your support keeps me motivated to bring you valuable insights. Stay updated and never miss out on our latest posts. Feel free to leave comments or suggestions for future topics. Happy learning!"

https://awslearner.hashnode.dev/amazon-web-services-via-category

https://awslearner.hashnode.dev/aws-beginner-level-project-ideas

0
Subscribe to my newsletter

Read articles from Utkarsh Rastogi directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Utkarsh Rastogi
Utkarsh Rastogi

👨‍💻 AWS Cloud Engineer | Around 6 years of Corporate Experience | Driving Innovation in Cloud Solutions 🔧 Day-to-Day Tasks: Specialize in creating AWS infrastructure for Migration Projects. Leveraging services such as S3, SNS, SQS, IAM, Lambda, System Manager, Kinesis, OpenSearch, Cognito, Storage Gateway, Cloud Watch, API Gateway, AWS Event Scheduler, Secret Manager, ECS, Application Load Balancer, VPC among others. Additionally, I excel in crafting Splunk Dashboards and implementing alerting mechanisms for Cloud Watch logs to monitor failures. My approach involves constructing AWS infrastructure using the Serverless framework and Cloud Formation templates, while automating tasks through Boto3 (Python Scripting) Lambdas. 🎯 Passion: I am deeply passionate about continuously learning new technologies and eagerly anticipate the transformative impact of cloud computing on the tech landscape. 📧 Connect: Feel free to reach out to me at awslearningoals@gmail.com. Let's connect and explore potential collaborations! https://www.linkedin.com/in/rastogiutkarsh/