Skip to content

A simple webapp that uses a Lambda function to calculate the given power of a base number provided by the user. This app involves Lambda, API Gateway, IAM, DynamoDB and lastly is hosted with AWS Amplify.

Notifications You must be signed in to change notification settings

muskaanbahri/AWS-End-to-End-WebApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

AWS End to End Web Application

This project demonstrates the integration of five AWS services—Amplify, Lambda, IAM, API Gateway, and DynamoDB—to create and deploy a web application that calculates the power of a given base and exponent. The result of the calculation is stored in a DynamoDB table. https://dev.d2vzk0vjl847d4.amplifyapp.com/

AWS End to End Web Application

Architecture

Amplify : Used to deploy and host the web application.

Lambda: Contains the function that performs the power calculation (base^exponent).

IAM: Manages permissions, ensuring secure access to the DynamoDB table for storing results.

API Gateway: Creates and manages the POST API that triggers the Lambda function.

DynamoDB: Stores the results of the power calculations.

endtoendarchitecture

IAM Execution Policy

{
"Version": "2012-10-17",
"Statement": [
    {
        "Sid": "VisualEditor0",
        "Effect": "Allow",
        "Action": [
            "dynamodb:PutItem",
            "dynamodb:DeleteItem",
            "dynamodb:GetItem",
            "dynamodb:Scan",
            "dynamodb:Query",
            "dynamodb:UpdateItem"
        ],
        "Resource": "YOUR-TABLE-ARN"
    }
    ]
}

Lambda function used:

import json
import math
import boto3
from time import gmtime, strftime
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('powerofmathdb')
now = strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())

def lambda_handler(event, context):
    mathResult = math.pow(int(event['base']), int(event['exponent']))
    response = table.put_item(
        Item={
            'ID': str(mathResult),
            'LatestGreetingTime':now
            })
    return {
    'statusCode': 200,
    'body': json.dumps('Your result is ' + str(mathResult))
    }

Link for the Web App

Click here!

Screeshots:

WhatsApp Image 2024-06-12 at 18 14 24_23d9a873 WhatsApp Image 2024-06-12 at 18 14 37_1903daae

About

A simple webapp that uses a Lambda function to calculate the given power of a base number provided by the user. This app involves Lambda, API Gateway, IAM, DynamoDB and lastly is hosted with AWS Amplify.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages