Professional Documents
Culture Documents
Description:
In the ‘serverless’ way of doing things, we don’t need to think about servers. Because, the capacity planning, scaling,
high availability, and fault tolerance — typically expected of a server — are automatically managed by Cloud
provider. In this case, we will consider AWS (cloud provider). AWS offers a plethora of services that follow the
serverless model, including but not limited to SNS, SQS, Lambda, and SES. One can use these services just by
subscribing to them and without actually contacting the server. This eliminates the need to split your attention to
ensure all systems are updated and maintained, allowing you to spend more time on the core operations of your
business.
Often, companies take feedback from their customers. A book publishing company, for instance, takes the feedback
on the newly published book. A cosmetic company takes feedback, on the newly launched cosmetic product. So,
after collecting the customer feedback, companies tend to aggregate them all to comprehend the most common
issues with the product, and accordingly tweak the product and the marketing strategy designed for the product.
Until now, taking the feedback required creating an EC2 instance, RDS Database, etc. But, in this use case, we will
use the `serverless` technologies to build up a feedback website.
Steps to be perfomed:
S3 – For storing the web pages
DynamoDB – For storing the feedback results
Cognito – To provide the website access to the backend database
IAM – To specify what permissions to be given
"Version": "2012-10-17",
"Statement": [
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::Registration-form/*"
}
Now create a another bucket naming feedback form ,same as previous bucket.
Also block public access setting and upload feedback.htmlfile in the bucket.
Go to properties tab and enable static web hosting as previous step and specify the index
document.
And set permissions, to give public read access.
Click on create.
3. To specify what permissions to be given
Open IAM service in aws console.
Click on roles under access management and click on create roles.
Select aws service as a trusted entity type, and lambda as a use case.
Click on next
In add permissions step, search for amazon apigateway administrator, and amazon
dynamodb fullaccess.
Copy the url feedback.html from the feedback bucket and paste it in the callback URL.
Check availability and give amazon coginto domain. And click save button.
5.lambda function
Search and open lambda
Click on create function
6.API gateway
Open aws console and search for api gateway.
Click on create.
Under the api tab on resources,click actions tab and click on create resource and name
the resource and click create.
Now deploy the api give a stage name and click on deploy.
Now the inoke url has been created, copy the url.
Paste it in the java script function in feedback.html file save and upload the updated file
in the same feedback bucket.
In the lambda envinronment type the below code , to save the results in the dynamodb.
Click on deploy and save.