Serverless Contact Form
Built a fully serverless contact form using API Gateway, Lambda, DynamoDB, and SES. Used in a mid-size company for managing both client inquiries and HR form submissions.
7/16/20252 min read


Introduction
Every website needs a contact form — but not every form needs a server.
In this project, I built a serverless contact form architecture using AWS that securely collects user submissions, stores them in a database, and instantly notifies a recipient via email. It’s fast, scalable, and requires no infrastructure management.
This solution was originally implemented for a mid-size company that needed a way to handle both client inquiries and HR-related submissions — such as job applications — directly from their website. I later adapted it for my personal portfolio to demonstrate how serverless architecture can simplify business workflows.
Project Goals
Collect and process contact form submissions securely
Store structured user data for future reference
Notify team members in real-time
Eliminate the need for any backend servers
Apply AWS best practices for event-driven, serverless design
Frontend (Form UI)
The form is built into my static portfolio website hosted via S3 + CloudFront. It includes:
Name, Email, and Message fields
Basic client-side validation
When the form is submitted, a JavaScript function sends a POST request to a public API Gateway endpoint with the user's input in JSON format.
API & Lambda Logic
At the heart of the backend is AWS Lambda, triggered by API Gateway.
The Lambda function:
Validates and sanitizes user input
Assigns a unique ID and timestamp
Saves the message in a DynamoDB table
Sends a notification email via Amazon SES
This is a stateless and efficient way to process requests with no idle compute cost.
Data Storage (DynamoDB)
Submissions are logged in a DynamoDB table, with each item including:
UUID
Name, Email, Subject, Message
Timestamp
This allows the business to later export, query, or audit form submissions with high availability and low latency.
Email Notification (SES)
Each time a message is submitted:
Lambda triggers Amazon SES to send a formatted email to the appropriate department
Different templates and recipients can be configured based on submission type (e.g., HR or Sales)
All emails are sent over a verified domain to ensure delivery
During development, SES ran in sandbox mode, but the system is fully ready for production usage.
Security
IAM roles grant Lambda minimum required permissions
API Gateway includes throttling and request validation
Environment variables are used for configuration — no secrets are hardcoded
Input sanitization prevents injection or malformed data attacks
Preflight CORS settings are configured for safe cross-origin POST requests
Deployment
The initial version was deployed using the AWS Console, but I’m now converting this entire stack to AWS CDK for repeatable, scalable deployment across environments.
Future CI/CD integration will:
Trigger updates to Lambda code on GitHub push
Automatically re-deploy API Gateway and DynamoDB configuration
Apply rollback policies on failed builds
Real-World Application
I built the first version of this solution for a mid-size company that needed an efficient, automated way to:
Capture and store client inquiries
Allow job applicants to submit basic information via web forms
Route notifications to different teams based on message type
They previously used email-only workflows with no backend recordkeeping. This project helped them centralize form data and reduce response delays — all without setting up or maintaining servers.
Lessons Learned
Deepened my understanding of API Gateway + Lambda integrations
Learned how to manage SES domain verification and sandbox restrictions
Designed for multi-purpose form use across departments
Practiced DynamoDB schema planning for real-time write operations
Strengthened my serverless development and security skills
Conclusion
This serverless contact form project proves that you don’t need a traditional backend to build powerful, real-world web features. By using AWS’s event-driven architecture, I created a solution that handles dynamic user input, persists data, and sends alerts — all with virtually no infrastructure overhead.
🛠️ Tech Stack:
Amazon API Gateway
AWS Lambda
Amazon DynamoDB
Amazon SES
IAM