DynamoDB — Intro with quick-start examples

bschandramohan
Jun 26 · 2 min read

DynamoDB is a NO-SQL, key-value and document database. It’s developed and supplied by Amazon AWS — i.e., it’s a fully managed system where Amazon AWS takes care of the provisioning, clustering, scaling, throughput adherence, backup and restore, etc., based on the configurations.

DynamoDB can handle more than 10 trillion requests per day and can support peaks of more than 20 million requests per second.

Read more about the benefits in their homepage

I am not a huge fan of tutorials, but this is one you can refer to: https://aws.amazon.com/getting-started/tutorials/create-nosql-table/

The one I used for my learning was the developer guide:

Core Components

Tables, Items, and Attributes

Primary Key: Partition Key OR Partition Key + Sort Key — Partition Key Design

Secondary Indexes

Streams

API Layer

Control Plane (a.k.a DDL in SQL)

Data Plane (a.k.a DML in SQL)

Stream APIs

Transactions

Data Types

Scalar types, Document types, Set types

Let’s go onto trying out stuff!

We can try DynamoDB in 2 different ways :

  1. Connect to the AWS web service (they have free trials)
  2. Have a local instance in your machine -can be installed in 3 ways —
    a. Download tar and run the jar locally (Link)
    b. Use dynamodb docker image (Link)
    c. Use brew (Link)

We use AWS CLI or AWS SDK to connect to DynamoDB. For this article, let’s use AWS CLI.

To configure aws, run below: (reference this link ; For local dynamodb access key id and secret access key can be anything fake)

Now you should be able to query local dynamodb from cli using commands like:

Creating a table:

Verifying the table structure:

Putting an Item (primary key — (here, partition key + range key) is mandatory)

Getting an item: (Pass primary key (here, partition key + range key) to fetch)

Querying items:

TechieConnect

My technical posts mostly on Java backend services

bschandramohan

Written by

Software Engineer working on Java based Micro-services deployed on AWS cloud. California, US resident currently — born and brought up in Bangalore, India.

TechieConnect

My technical posts mostly on Java backend services

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade