Set up AWS DynamoDB
In this section, DynamoDB is used as a NoSQL database to store and manage the data of the web application. It allows users to perform create, read, update, delete (CRUD) operations on data items quickly and flexibly, suitable for serverless applications with fluctuating traffic.
- Go to AWS Management Console
- Find DynamoDB
- Select DynamoDB

- In the DynamoDB interface, select Create Table

- In the Create Table interface
- Enter Table name as
serverless-web-application-on-aws
- Enter Partition key as
id
- Scroll to the bottom of the page, select Create table

- After the table status changes to Active
- Select the newly created table
- Select Actions, then select Explore items


- In the create item interface
- Select Add new attribute, choose Number
- Enter Attribute name as
views
- Enter value sequentially as 0, 1
- Select Create item

- Go to AWS Management Console

- In the IAM interface
- Select Role from the sidebar
- Select Create role

- In the Create role interface
- In the Trusted entity type section, select AWS Service
- In the Use case section
- In the Service or use case field, select Lambda
- Select Next

- In the Add Permissions section
- Search for dynamo
- Select AmazonDynamoDBFullAccess
- Select Next

- In the Name, review and create section
- In the Role name field, enter
serverless-web-application
- Scroll to the bottom of the page, select Create role
