Follow dba-ninja.com

Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions

dba-ninja.com Links

Dba_db2_button

Sqlserver_dba_button

What is DynamoDB and how it works?

22 July,2022 by Rambler

Question: I'm currently using MongoDB on-premises and reviewing alternative options for storing NoSQL data. Our usage of MongoDB is very limited from a development pov , and looking for a much lighter weight NoSQL setup. What is DynamoDB and how does it work?

Answer:  DynamoDB is a managed NOSQL Service offered by AWS. The AWS documentation is very comprehensive   and should be referenced for detailed information .    Tables , Items & Attributes are essential concepts . 

A table is a collection of items 

Every item is a collection of attributes. 

Primary keys are used as unique identifiers 

Secondary Indexes are used to enhance queries

DynamoDB streams can be used  for data modification Events

 

To create a DynamoDB table you can use different interfaces , either through the AWS Console or Terraform 

Open the DynamoDB console at https://console.aws.amazon.com/dynamodb/.

Choose Create Table.

In the Create DynamoDB table screen, do the following:

On the Table name box, enter  "my table name"

For the Primary key, in the Partition key box, enter "my Id". Set the data type 

When the settings are as you want them, choose Create.

 

Create_DynamoDB_table

 

Once you have the DynamoDB table setup , need to think about the backup requirements - check out AWS Backup Service

The AWS Backup Service supports DynamoDB as one of the Resource types . 

 

To start adding items to DynamoDB ,  use either the DynamoDB API, or PartiQL , a SQL-compatible query language, to add an item to a table. There is a new feature in the AWS Console for DynamoDB called PartiQL Editor , allowing you to edit data in the DynamoDB table. Another option is to use the Console - where you can create an Item and attach attributes

 

If you want to use AWS CLI for creating a DynamoDB table , here is a sample to create a basic DynamoDB table .

 

aws dynamodb create-table \
    --table-name Cars \
    --attribute-definitions \
        AttributeName=Engine,AttributeType=S \
        AttributeName=Fuel,AttributeType=S \
    --key-schema \
        AttributeName=Engine,KeyType=HASH \
        AttributeName=Fule,KeyType=RANGE \
    --provisioned-throughput \
        ReadCapacityUnits=5,WriteCapacityUnits=5 \
    --table-class STANDARD

For  more aws cli commands use AWS CLI Cheatsheet


Author: Rambler (http://www.dba-ninja.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on What is DynamoDB and how it works?


dba-ninja.com