Releases: https://github.com/OmarThinks/AWS-Full-Stack-Project/tags
I will shut these links down when I am done with the application.
I will turn every thing off so that I do not get out of AWS Free Tier.
Keeping these links alive might get me out of AWS Free Tier.
Link | |
---|---|
Amplify Frontend (With React) | https://dev9463.d1pi9xfkfb20dm.amplifyapp.com |
AWS API Gateway (Backend) | https://67nbvuy3t1.execute-api.us-east-2.amazonaws.com/dev/ |
- AWS
- Amazon API Gateway
- Amazon DynamoDB (NoSQL DB)
- AWS Lambda (Serverless)
- IAM (Identity)
- AWS Amplify (Frontend) (With React Application)
- JavaScript
- NodeJS
- React
- NodeJS
- Python
- Postman
https://dev9463.d1pi9xfkfb20dm.amplifyapp.com/
This is the link of the Frontend Application with React.
You can input first name and last name.
This is a very basic lambda function.
- Inputs (JSON):
- firstName (String)
- lastName (String)
- Output:
- "Hello from Lambda, " + firstname + lastName
- Example:
- Input:
{
"firstName": "Omar",
"lastName": "Magdy"
}
- Output:
{
"statusCode": 200,
"body": "\"Hello from Lambda, Omar Magdy\""
}
- https://67nbvuy3t1.execute-api.us-east-2.amazonaws.com/dev
- Method: POST
- Reuest Body: JSON
- Inputs:
- firstName (String)
- lastName (String)
Example:
Input:
curl --location --request POST 'https://67nbvuy3t1.execute-api.us-east-2.amazonaws.com/dev' \
--header 'Content-Type: application/json' \
--data-raw '{
"firstName":"Omar",
"lastName":"Magdy"
}'
I have also used a Postman collection to test the request.
Output:
{
"statusCode": 200,
"body": "\"Hello from Lambda, Omar Magdy\""
}
I have made the permissions that anyone can access and delete
the data in the DynamoDB Database.
This is the permissions JSON.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"dynamodb:PutItem",
"dynamodb:DeleteItem",
"dynamodb:GetItem",
"dynamodb:Scan",
"dynamodb:Query",
"dynamodb:UpdateItem"
],
"Resource": "<Database ARN>"
}
]
}
And this is the New python code:
import json
import boto3
from time import gmtime, strftime
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('HelloWorldDatabase')
now = strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())
def lambda_handler(event, context):
name = event['firstName'] +' '+ event['lastName']
response = table.put_item(
Item={
'ID': name,
'LatestGreetingTime':now
})
return {
'statusCode': 200,
'body': json.dumps('Hello from Lambda, ' + name)
}
There is a unique ID to each record.
I used these guides to help me develop an aoolication by myself.