-
A serverless student management system is a cloud-based application that enables the management of student data (CRUD operations) without the need to manage or provision traditional servers, leveraging AWS Serverless services
-
We can add/edit/delete details of Student like name, roll no./id, email, contact number.
-
Technologies used : AWS Amplify, Amazon API Gateway, AWS Lambda, Amazon DynamoDB.
- This is project eligible for Free tier
Service | DynamoDB | Lambda | API Gateway | Amplify |
---|---|---|---|---|
Free Tier Limits |
demo-serverless-stud.mp4
GetAll | Get |
---|---|
Post |
---|
Put | Delete |
---|---|
NOTE: Refer architecture diagram given above
- To store student details/data, we have used DynamoDB:
- we have created two tables
crud-dynamodb-sahal-v1
andCounterTable
. - 1st table will store actual data, while 2nd table,
CounterTable
is used to store counter of no. of items in 1st table, for implementing auto-increment functionality.
- we have created two tables
- To perform CRUD, backend is implemented utilising Lambda, Function as a Code:
- To allow our function to communicate with Database, we have to give permission:
- we have created IAM Role :
crud-role-sahal-v1
- Above role is attached IAM policy:
- Inline Policy: Allowing ScanItem, Read, Put, Write, etc, with resource as two tables only, following Principle of Least Privilege.
- Policy: auto created to write logs in CloudWatch.
- we have created IAM Role :
- Configuration:
- Runtime : Python 3.13
- Arch : ARM
- Library : boto for working with AWS services, Decimal for conversion between DynamoDB Decimal <=> int/float.
- Internal Logic is similar to any management system, performing CRUD, but in POST method, create operation:
- we first read & increment counter value from
CounterTable
and store instudent_id
- we then use
student_id
as id (primary/partition key) to add item in main tablecrud-dynamodb-sahal-v1
- we first read & increment counter value from
- Refer :
./src/lambda_function.py
- To allow our function to communicate with Database, we have to give permission:
- To host our API, we have leveraged API Gateway:
REST API
withRegional
Endpoint is used.- Enabled
CORS
in all methods, Lambda proxy integration, which is forwarding all data to lambda i.e. API G/W ==[data, method, headers, path, query string, body, etc.]==> Lambda fn(). - Resource and Methods are as follows:
Path Method Description /students GET return a list of all students /students POST create a new student /students/{id} GET return a student /students/{id} PUT update a student /students/{id} DELETE delete a student
- For Hosting Front End we have used AWS Amplify:
- A single HTML file, containing JS with API endpoint is manually deployed using build.zip file
- Although we can used VSC repository like Github, Gitlab, CodeCommit, etc, for sake of simplicity we have directly deployed zip file (index.html & arch-image JPEG).
- Results:
- Postman: we have tested all APIs with Postman web console
- Amplify Hosted:
https://dev.dssny3wnuvblt.amplifyapp.com
(resource deleted now)- few data already added using AWS Management Console in both DynamoDB Tables
- we can seamlessly perform SAVE(create), edit(update), delete operation
- Additionally, there is button Architecture, which on pressed, pops up an image of
System Architecture Diagram
.
-
Where is ARN of 😡DyanamoDB Tables? to put in policy of of IAM ROLE
- GSearch: where to find arn of dynamo db table?
- ARN is easily constructed from your account and table details it's arn:aws:dynamodb:{region}:{userID}:table/{tableName}
- Sol: It is available, on pressing Additional Info just below,
- 😂 Impatient Me!!!
-
Due to wrong configuration of API Path in API Gw, I fixed it, but still the same error
- Sol: Deploy API again in API GW. >> Forgot to redeploy 😗
-
Why i cant access my data in Web browser, index.html file, in postman it works!!
- Sol: CORS error
- Although, enabled CORS in API gateway, we have to return CORS header in Lambda function.
- doesn't know, worked for me🙃
- Hit 🎯 star button if you liked my work