Step-by-step implementation for deploying a modern, serverless, three-tier application on AWS

I have been working as a DevOps engineer @TESCRA for an Airlines Client. Mainly on Platform Engineering and Application logging and monitoring end
This guide provides the step-by-step implementation for deploying a modern, serverless, three-tier application on AWS
Frontend (Presentation Tier): AWS Amplify
Backend (Application Tier): AWS Lambda (Python)
API Layer: Amazon API Gateway
Database (Data Tier): Amazon DynamoDB (NoSQL)
Github repo : https://github.com/jaswanthnasa/Cloud-Serverless-Project
1. Deploy the Frontend using AWS Amplify
The frontend of the application is a web application deployed via AWS Amplify.
Navigate to Amplify: Go to the AWS Console and search for AWS Amplify.
Start Deployment: Click on Deploy an app and then select GitHub (or your chosen repository provider).
Connect Repository: Authenticate with your GitHub account and select the project repository (e.g.,
cloud-serverless-project) and the branch you wish to deploy.Specify Code Path: Check the option to "Choose an existing repository and branch for your app's frontend" and specify the subdirectory for the frontend code, which is
frontend.Deploy: Click Next and then Save and deploy.
- Amplify will automatically build and deploy the web application, providing a public domain URL once complete.

2. Configure the DynamoDB Database
Next, you will create the NoSQL table that will store the student details.
Navigate to DynamoDB: Go to the AWS Console and search for DynamoDB.
Create Table: Click Create table.
Table Details:
Table name:
Student-DetailsPartition key:
ID(select the String data type)
Finalize: Leave all other settings as default and click Create table.

3. Set Up Lambda Backend Functions and IAM Role
You will create two Lambda functions for the application's API logic (GET and POST) and grant them permission to interact with DynamoDB.
A. Create add-student-function (POST)
Create Lambda Function: Go to Lambda and click Create function.
Configuration:
Function name:
add-student-functionRuntime: Python 3.10
Permissions: Select Create a new role with basic Lambda permissions.
Deploy Code: Copy the Python code for the post method (found in the repository's
backend/postfolder) into the Lambda function's code editor, replacing the default code. Click Deploy.
B. Add DynamoDB Permissions
The Lambda function needs permission to write data to the DynamoDB table.
Access IAM Role: In the
add-student-functionconfiguration, go to Configuration > Permissions and click on the Role name to open the IAM console.Create Inline Policy: Click Add permissions > Create inline policy.
Paste Policy: Switch to the JSON tab and paste the required DynamoDB policy (from the repository's
DynamoDB_policyfile). Crucially, ensure you update the ARN in the JSON to match your AWS account ID and table name.Save: Name the policy (e.g.,
DynamoDB-permission) and click Create policy.
C. Create get-student-function (GET)
Create Lambda Function: Go back to Lambda and click Create function.
Configuration:
Function name:
get-student-functionRuntime: Python 3.10
Permissions: Select Use an existing role and choose the role created for the
add-student-function(which now has DynamoDB permissions).
Deploy Code: Copy the Python code for the get method (from the repository's
backend/getfolder) into the function's editor and click Deploy.
4. Configure API Gateway
The API Gateway acts as the public-facing entry point for your Lambda functions.
Create REST API: Go to API Gateway and click Create API. Select REST API and click Build.
- API Name:
Student-API(or similar).
- API Name:
Create Resources:
Click Actions > Create Resource. Set the Resource Path to
add-studentand click Create Resource.Click Actions > Create Resource again. Set the Resource Path to
get-studentand click Create Resource.
Create POST Method for
/add-student:Select the
/add-studentresource. Click Actions > Create Method.Select POST.
Set Integration type to Lambda Function.
For Lambda Function, select
add-student-function. Click Create Method.
Create GET Method for
/get-student:Select the
/get-studentresource. Click Actions > Create Method.Select GET.
Set Integration type to Lambda Function.
For Lambda Function, select
get-student-function. Click Create Method.
Deploy API:
Click Actions > Deploy API.
Select [New Stage] and set the Stage Name (e.g.,
student-api).Click Deploy. Note the Invoke URL displayed (this is your API base URL).

5. Connect Frontend and Resolve CORS
The final step is to link the Amplify frontend with the API Gateway backend.
Update Frontend Endpoints:
In your local copy of the repository's frontend code (e.g.,
app.js), replace the placeholder API endpoint variables with the Invoke URL from API Gateway.The full endpoint URLs should be:
GET Endpoint:
[Invoke URL]/get-studentPOST Endpoint:
[Invoke URL]/add-student
Commit and push these changes to your GitHub repository. Amplify will automatically detect the changes and redeploy the frontend.
Enable CORS on API Gateway: To prevent cross-origin resource sharing (CORS) errors, you must enable it on the API Gateway.
In API Gateway, select the
/add-studentresource. Click Actions > Enable CORS.In the configuration:
Set Access-Control-Allow-Origin to the exact domain URL of your deployed Amplify app (e.g.,
https://main.xxxxxxxx.amplifyapp.com) without a trailing slash.Ensure POST is selected in Access-Control-Allow-Methods.
Click Save.
Repeat the same Enable CORS process for the
/get-studentresource, setting the same Access-Control-Allow-Origin domain and ensuring GET is selected.
Re-deploy API: After enabling CORS, you must deploy the API again for the changes to take effect.
- Click Actions > Deploy API and select your existing stage (e.g.,
student-api). Click Deploy.
- Click Actions > Deploy API and select your existing stage (e.g.,


The application is now fully functional. You can access the Amplify app URL to view existing data and add new records, validating the end-to-end serverless implementation.
🗑️ Clean Up Process (Resource Deletion)
After testing your application, it's crucial to delete all created AWS resources to stop incurring ongoing costs. Follow these steps in order, as some resources depend on others.
Step 1: Delete the API Gateway
Go to API Gateway in the AWS Console.
Select the
Student-APIREST API.From the Actions dropdown, choose Delete API. Confirm the deletion.
Step 2: Delete Lambda Functions and CloudWatch Logs
Delete Functions: Go to AWS Lambda.
Select both
add-student-functionandget-student-function.From the Actions dropdown, choose Delete. Confirm the deletion.
Delete Log Groups: Go to CloudWatch > Log Groups.
Search for the log groups associated with your Lambda functions (names typically start with
/aws/lambda/).Select the log groups for both functions and choose Actions > Delete log group. Confirm the deletion.
Step 3: Delete the DynamoDB Table
Delete Table: Go to DynamoDB in the AWS Console.
Select the
student-detailstable.Click the Delete button and confirm the deletion.
Step 4: Delete the IAM Role and Policy
Since the Lambda functions are deleted, you can remove the role they used.
Delete Role: Go to IAM > Roles.
Search for the Lambda execution role (the one created automatically or the one you manually configured).
Select the role and click Delete role. Ensure any inline policies (like the
DynamoDB-permission) are removed with the role.
Step 5: Delete the AWS Amplify App
Delete App: Go to AWS Amplify.
Select your deployed application (the one connected to your GitHub repository).
In the top right corner, click Actions > Delete app. Confirm the deletion. This will remove all frontend hosting resources.



