Introduction
Collecting user feedback is essential for improving products, but many companies still rely on outdated systems that require server maintenance, patching, and scaling headaches.
I recently built a serverless feedback collection system using AWS Lambda, API Gateway, DynamoDB, and S3. This blog walks you through the architecture, implementation steps, and benefits — so you can build your own, without worrying about infrastructure management.
Why Serverless?
Serverless architecture allows you to run backend logic without managing servers. You only pay for execution time, making it cost-effective for workloads with unpredictable traffic, such as feedback forms.
Benefits of going serverless:
- No server management – AWS handles provisioning and scaling.
- Lower costs – Pay only when code runs.
- Scalable – Automatically handles traffic spikes.
Architecture Overview
Here’s the AWS architecture for the feedback system:
- Frontend (HTML/JS) hosted on Amazon S3 – This is where users submit feedback.
- API Gateway – Receives the POST request from the frontend.
- AWS Lambda – Processes the request and writes data to DynamoDB.
- DynamoDB – Stores feedback data in a NoSQL format.
- IAM Roles & Policies – Secure service-to-service communication.
(You can use AWS Architecture Icons from the official set to make a diagram for publishing)
Step-by-Step Implementation
Step 1 – Create the DynamoDB Table
- Table name: FeedbackTable
- Partition key: feedbackId (String)
- No sort key (optional depending on your design)
- Enable on-demand capacity for auto-scaling.
Step 2 – Write the Lambda Function
Example Python Lambda code:
import json
import boto3
import uuid
from datetime import datetime
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('FeedbackTable')
def lambda_handler(event, context):
body = json.loads(event['body'])
feedback_id = str(uuid.uuid4())
timestamp = datetime.utcnow().isoformat()
table.put_item(
Item={
'feedbackId': feedback_id,
'name': body['name'],
'email': body['email'],
'feedback': body['feedback'],
'createdAt': timestamp
}
)
return {
'statusCode': 200,
'body': json.dumps({'message': 'Feedback submitted successfully!'})
}
Step 3 – Create an API Gateway Endpoint
- Create a new REST API in Amazon API Gateway.
- Create a resource /feedback and a POST method.
- Integrate it with your Lambda function.
- Enable CORS so it can be called from your frontend.
Step 4 – Host the Frontend on S3
Simple HTML form example:
<form id="feedbackForm">
<input type="text" name="name" placeholder="Your Name" required>
<input type="email" name="email" placeholder="Your Email" required>
<textarea name="feedback" placeholder="Your Feedback" required></textarea>
<button type="submit">Submit</button>
</form>
<script>
document.getElementById('feedbackForm').addEventListener('submit', async function(e) {
e.preventDefault();
const data = {
name: this.name.value,
email: this.email.value,
feedback: this.feedback.value
};
await fetch('YOUR_API_GATEWAY_URL', {
method: 'POST',
body: JSON.stringify(data),
headers: {'Content-Type': 'application/json'}
});
alert('Feedback submitted!');
});
</script>
- Upload this to your S3 bucket.
- Enable static website hosting.
Step 5 – Secure with IAM
- Create an IAM role for the Lambda function with DynamoDB:PutItem permission.
- Restrict API Gateway to accept only requests from your S3 frontend.
Testing the App
- Open the S3 website URL.
- Submit a feedback form.
- Check DynamoDB to see the new entry.
Cost Considerations
This architecture is highly cost-efficient:
- Lambda – First 1M requests/month are free.
- API Gateway – Small cost per million requests.
- DynamoDB – On-demand pricing; pay only for what you use.
- S3 – Minimal hosting costs.
Real-World Impact
This system is ideal for:
- SaaS apps collecting customer feedback.
- Event feedback forms.
- Internal employee suggestion portals. When I implemented this in a training project, it handled 1,500+ feedback submissions without any downtime — and cost less than $1/month.
Conclusion
Serverless applications on AWS can drastically simplify development, reduce costs, and improve scalability. With just Lambda, API Gateway, DynamoDB, and S3, you can create a fully functional, secure, and low-maintenance feedback system.
Top comments (0)