jicoing
Posted on January 3, 2021
After setting up the visitor counter for my website, it was time for setting up the backend database for storing the count data. I chose AWS DynamoDB
for this purpose. It is a NoSQL database that works primarily on key value pair, requires only a primary key and doesn’t require a schema to create a table. Sounds magical.
DynamoDB
I selected create table
from the DynamoDB console.
Then I named the table as komlalebuTable
and mention the primary key as id
with data type as string
.
Also I unchecked the default
setting of the table and selected on-demand
pricing which makes it practically free for my use case.
This table stores the visitor count of my website in near realtime as we can see below using AWS (API Gateway + Lambda) on page load, which we will explore later sections**.
The like
button appends the string 'YES' to the count value and adds a record.
The dislike
button appends the string 'NO' to the count value and adds a record.
AWS::Serverless::SimpleTable
However this was the manual method of creating a table from AWS console, the final version of the source code is using a table that is created using SAM template (Read more). With the table name as komlalebuTable
.
komlalebuTable:
Type: AWS::Serverless::SimpleTable
Properties:
PrimaryKey:
Name: id
Type: String
TableName: komlalebuTable
And the backend database was setup.
Posted on January 3, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 2, 2024