In this project, I built a fully serverless Student Management Web App using AWS.
The application allows users to insert student data and retrieve existing student records, using:
AWS Lambda
DynamoDB
API Gateway
S3 Static Hosting
CloudFront CDN
This article contains everything needed to recreate the project from scratch
1. Create DynamoDB Table
Go to DynamoDB
Click Create Table
Table name → studentData
Partition key → studentid (String)
💡 Make sure the partition key exactly matches your Lambda code.
🟧 2. Create IAM Role for Lambda
Go to IAM → Roles → Create Role
Use case → Lambda
Attach policy:
✔ AmazonDynamoDBFullAccess
Name → lambda-dynamodb-full-access
Create role
🟩 3. Create Lambda Function – GET Data
Open AWS Lambda
Create function → Python 3.12
Execution role → Use existing role
Select lambda-dynamodb-full-access
Paste code from getstudents.py
Deploy
🟩 4. Create Lambda Function – INSERT Data
Create function → Python 3.12
Execution role → Use existing role
Select lambda-dynamodb-full-access
Paste code from insertstudentdata.py
Deploy
🔵5. Build REST API with API Gateway
Go to API Gateway
Choose Build under REST API
API name → anything
Endpoint type → Edge Optimized
Click Create API
Create Methods
GET Method
Resource /
Create Method → GET
Integration → Lambda
Choose GET Lambda (function-1)
POST Method
Resource /
Create Method → POST
Integration → Lambda
Choose POST Lambda (function-2)
Enable CORS
Select resource
Click Enable CORS
Deploy API
Deploy → New stage → prod
Copy Invoke URL
Paste this URL inside your script.js
🟣 6. Create S3 Bucket for Front-End
Go to S3 → Create bucket
Block Public Access → Enabled (default)
Upload index.html and script.js
*🟠 7. Enable Static Website Hosting in S3
*
Go to Properties
Scroll to Static Website Hosting
Enable
Set:
Index document → index.html
Error document → index.html
🟢 8. Write S3 Bucket Policy for CloudFront Access
Since the bucket will be private, CloudFront needs explicit access.
You will add a policy like:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowCloudFrontAccess",
"Effect": "Allow",
"Principal": {
"Service": "cloudfront.amazonaws.com"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::your-bucket-name/*",
"Condition": {
"StringEquals": {
"AWS:SourceArn": "arn:aws:cloudfront::YOUR-ACCOUNT-ID:distribution/YOUR-DISTRIBUTION-ID"
}
}
}
]
}
Replace the 3 fields:
your-bucket-name
your AWS account ID
your CloudFront distribution ID
🔵 9. Create CloudFront Distribution for S3 Website
Go to CloudFront
Click Create Distribution
Key Settings
Origin domain → Your S3 bucket
Origin access → Origin Access Control (OAC) → Create new
Viewer protocol policy → Redirect HTTP to HTTPS
Default root object → index.html
Important:
✔ Make the S3 bucket private
✔ CloudFront will access the bucket using OAC
Finish creation
Copy the CloudFront Distribution Domain Name
(example: d123xyzabcdef.cloudfront.net)
💡 Use this URL as your website link.
🔵 10. Add CORS Rules to S3 (Optional)
[
{
"AllowedHeaders": ["*"],
"AllowedMethods": ["GET", "POST", "PUT", "DELETE", "HEAD"],
"AllowedOrigins": ["*"],
"ExposeHeaders": ["ETag"],
"MaxAgeSeconds": 3000
}
]
🎉 Final Output
Your system now supports:
✔ Insert student data (POST Lambda)
✔ Fetch student data (GET Lambda)
✔ API communication through API Gateway
✔ Data stored in DynamoDB
✔ Frontend hosted on S3
✔ Distributed globally using CloudFront
✔ Secure bucket access using OAC
✔ CORS enabled
✔ Fully serverless and scalable
*📝 Conclusion
*

This project is perfect for learning:
Serverless backend development
DynamoDB NoSQL design
Lambda with Python
API Gateway routing
Secure S3 hosting
CloudFront CDN integration
IAM roles and permissions




Top comments (0)