No video

AWS Tutorial - Serverless Web Application in AWS Tutorial 2020

  Рет қаралды 18,993

Master2Teach

Master2Teach

Күн бұрын

In this video, you will learn
1. Serverless Web Application in AWS
2. We will use S3, DynomoDB, API Gateway and AWS Lambda to make our site serverless.
What we are going to learn in this video?
1. We will host a static web site in the S3 bucket.
2. Place HTML form on the site.
3. Using the post method, request send to API gateway.
4. Trigger the lambda function using the API gateway.
5. Store the data in DynamoDB.
How to host a static website in s3 Bucket?
• AWS Tutorial - Hosting...
On click on the submit button we are going to submit the name, email, and message to DynamoDB from lambda which will be trigger using API Gateway. So that the required URL will provide us by the API Gateway which we will learn in a few minutes.
Using the XMLHTTP request, the data will send.
Open the AWS console page.
Let’s check the s3 bucket first of all.
This is index.html file where are will replace after we generate the URL.
Open DynomoDB and create table.
Specify the table name.
Another we need to specify the partition key which will behave as the primary key. We have the only name, email, and message data. This is only for the demo so let’s put email id as a primary key.
Let’s create the lambda function. Navigate to Create function.
Author from scratch ok
Function name - Give the lambda function name that describes the purpose of your function.
Lok_lambda_function
As you can see there are different options for the runtime. We are going through Python.
Here we need to assign the IAM role to the Lambda function to have access to DynamoDB and API Gateway.
Create a new role for it.
Give a role name:
Lok_lamnda@role
This lambda role will have DynamoDB full access and API gateway administrator role.
Click the create role.
Check the use an existing role. Select the lambda role which we have just created.
Click Create function.
In the left, API gateway triggers the lambda and lambda function to store the data in DynamoDB.
Now let’s move to API Gate which will trigger the lambda.
Open API gateway.
In the Rest API section, navigate to the build button.
Rest protocol ok
Check new API
Give an API name
Lok_api
Description not compulsory
Endpoint type regional fine.
Click create API
In the Resources section, navigate to Action. From the drop-down section, click create the resource.
Provide the resource name. We are creating for contact us section so let’s name as contact us
We are going to call this API using the post method so let’s add the method. Again navigate to action dropdown and click create method.
Select the Post method and click in tick mark.
Integration type lambda function ok
In lambda function, type and choose the lambda function and save it.
Ok from client, method request then integrates request to lambda function and again integrates response to method response and finally to the client get a response.
Here we need the URL to use this API gateway. Still we didn’t get it.
For that, we need to deploy the API to get the required URL. So navigate to the action menu selecting the needed resources. From the dropdown, click in deploy API.
Here in which stage, would you like to deploy the api? New stage. Dev for now.
Click Deploy.
Copy the full URL, open the code. in API paste the URL and save the file.
API Gateway triggers the lambda function and lambda function store the data into DynamoDB which are going to do now.
Here you can see the default python code. We are going to place the python code which will store the data to the DynamoDB table.
I have already written the required codes.
import json
import boto3
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('tablename')
def lambda_handler(event, context):
print (event)
name = event['name']
email = event['email']
message = event['message']
table.put_item(
Item={
'name': name,
'email':email,
'message':message,
}
)
return 'added record successfully'
Let’s upload the new index file.
Now time to test it.
Added record successfully
We upload the HTML form in the s3 bucket. And using the XML HTTP request, we send data to API gateway using URL generated from API gateway. API gateway triggers the lambda function. Using python coding, the lambda function inserts the data to the DynamoDB table.
In this way we can use the serverless architecture in AWS using s3, API gateway, lambda, and DynamoDB.
Host static site in S3 Bucket:
• AWS Tutorial - Hosting...
SUBSCRIBE to our KZfaq channel for more videos:
www.youtube.co...
Like us on Facebook: / master2teach
For more content go to master2teach.com/
E-mail: master2teach@gmail.com

Пікірлер: 35
@pedrofreitaslima
@pedrofreitaslima 2 жыл бұрын
thanks you to share your knowledge is nice tutorial
@Master2Teach
@Master2Teach Жыл бұрын
So nice of you. Thanks for watching. Please don't forget to like, share, and subscribe.
@erock3737
@erock3737 2 жыл бұрын
Great presentation! Points clearly presented and organized. Thank you!!!
@anshikagupta4931
@anshikagupta4931 2 жыл бұрын
nice
@Master2Teach
@Master2Teach Жыл бұрын
Great!! thanks for watching. Please don't forget to like, share, and subscribe.
@souravsinha5330
@souravsinha5330 3 жыл бұрын
Very clearly explained. Nice tutorial, Beginer can also understand.
@Billy_Scoop
@Billy_Scoop Жыл бұрын
Thank you
@Master2Teach
@Master2Teach Жыл бұрын
You're welcome. Pls don't forget to subscribe :)
@seph2x538
@seph2x538 4 жыл бұрын
Excellent and concise tutorial. I really liked it. Continue putting out content you have the skill.
@Master2Teach
@Master2Teach 3 жыл бұрын
Much appreciated!
@sarfaraazshaik9309
@sarfaraazshaik9309 3 жыл бұрын
could you please tell from where you got a html file and code.?
@mohammadalaminsiam711
@mohammadalaminsiam711 3 жыл бұрын
This is really helpful
@playwithrishith5991
@playwithrishith5991 2 жыл бұрын
This is really great ! can you please share all the files you uploaded in S3 to try out the demo ?
@devprakash5320
@devprakash5320 2 жыл бұрын
great stuff
@raghawa_n7358
@raghawa_n7358 Жыл бұрын
Hii sir i delpoy my just like so it's not working show what u help me out. Bcs i edit my html code looking you but it's not work
@beingwoolen3542
@beingwoolen3542 3 жыл бұрын
Has anyone deployed it? Its showing an error for me.
@icikle
@icikle 3 жыл бұрын
I currently have a use case of a static page with a search function that pulls information from spotify's API and displays it on the page. This is achieved via client side javascript. I am looking to move the logic to a back end, hopefully serverless. What is the best way to achieve this given my end user goes to a website and sees a search page (presumably this can be hosted in S3 as a static HTML file), then they enter a search syntax and hit enter. I want them to not be taken away from the page or for the page to be refreshed, but for an API to be invoked, triggering a Lambda that does the heavy lifting, then returns the html to be spat out onto the page. Is this achievable, and how? How do I spit the HTML out onto the preexisting page?
@tanveertechfull
@tanveertechfull 3 жыл бұрын
Can we add code to upload and download files using api gateway? The code must be in c# and we need to use database sqlserver .
@vedashreenarsapurkar8111
@vedashreenarsapurkar8111 2 жыл бұрын
My values are not getting entered in dynamoDb table , no error is getting reflected in the console . Plz help me
@jenniesparr4072
@jenniesparr4072 3 жыл бұрын
Great tutorial! Is the html/js-code available anywhere?
@alejandrocr9293
@alejandrocr9293 3 жыл бұрын
thank you :D :D :D
@sagarbabu5945
@sagarbabu5945 4 жыл бұрын
Could you please do a video on creating and deploying a website ( uses RDS sql server) using Cloud Formation in server less manner
@muhammadzakifuadi7869
@muhammadzakifuadi7869 3 жыл бұрын
Can u help me ?, I can't deploy stage in API Gateway because it said "User does not have ListWebACLs and AssociateWebACL permissions for Web Application Firewall (WAF Regional). Stage settings except for WAF can still be changed."
@AnkitTrickerET
@AnkitTrickerET 3 жыл бұрын
can we use any other storage instead of s3 here
@mayanktripathi4u
@mayanktripathi4u 3 жыл бұрын
Hi Sir, I am getting below error "main.js:18 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience." Please suggest alternate method to use. Was trying with fetch(), however it also did not worked.
@yumnaiftikhar8770
@yumnaiftikhar8770 3 жыл бұрын
have you got any solution??
@subash_acharya
@subash_acharya 3 жыл бұрын
Are you from nepal?
@Master2Teach
@Master2Teach 3 жыл бұрын
Yes im. Thank you
@subash_acharya
@subash_acharya 3 жыл бұрын
@@Master2Teach Subscribed ! Do you have any messaging app so that i could get help from you
@Master2Teach
@Master2Teach 3 жыл бұрын
Pls mail me @ master2teach@gmail.com
@bimgonzaga
@bimgonzaga 3 жыл бұрын
Can you share the HTML page?
@Rahul-vg1sq
@Rahul-vg1sq Жыл бұрын
I want that codes can u send me
@pradeepdasari2615
@pradeepdasari2615 3 жыл бұрын
hello sir, can you please share the git repo of contact details which you wrote on html file. and can you please let us know where to give the api gateway URL
@jacksongejo597
@jacksongejo597 3 жыл бұрын
Please make the html code avilable
小丑把天使丢游泳池里#short #angel #clown
00:15
Super Beauty team
Рет қаралды 43 МЛН
Harley Quinn's revenge plan!!!#Harley Quinn #joker
00:59
Harley Quinn with the Joker
Рет қаралды 24 МЛН
Pool Bed Prank By My Grandpa 😂 #funny
00:47
SKITS
Рет қаралды 19 МЛН
Top 50+ AWS Services Explained in 10 Minutes
11:46
Fireship
Рет қаралды 1,5 МЛН
Introduction to AWS Lambda & Serverless Applications
56:02
Amazon Web Services
Рет қаралды 314 М.
How to secure your site with HTTPS - SSL Certificate - AWS
9:45
Master2Teach
Рет қаралды 34 М.
The Most Important AWS Core Services That You NEED To Know About!
18:09
Be A Better Dev
Рет қаралды 411 М.
AWS Amplify in Plain English | Getting Started Tutorial for Beginners
16:54
Tiny Technical Tutorials
Рет қаралды 48 М.