AWS – Amazon DynamoDB

DynamoDB

27

  • Amazon DynamoDB is a fully managed NoSQL database service.
  • It provide fast and flexible database services
  • Its flexible data model and reliable performance make it a great fit for mobile, web, gaming, ad-tech, Internet of Things (IoT), and many other applications.

Amazon DynamoDB

Amazon DynamoDB is a fully managed NoSQL database service..

It provides fast and predictable performance with seamless scalability.

It also reduce the administrative burdens of operating and scaling a distributed database, such as hardware provisioning, setup and configuration, replication, software patching or cluster scaling.

DynamoDB is used to create database tables that can store and retrieve any amount of data, and serve any level of request traffic.

DynamoDB allows to delete expired items from tables automatically to reduce storage usage and the cost of storing data that is no longer in use.

Data is stored on solid state disks (SSDs) and automatically replicated across multiple Availability Zones in an AWS region for providing built-in high availability and data durability.

Amazon DynamoDB components

  • Tables
  • Items
  • Attributes
  • Primary Keys
  • Secondary Indexes
  • Tables :

DynamoDB stores data in tables.

A table is a collection of data.

For example:

You could create a table named “Relations”, where you could store information about friends, family, or anyone else of interest.

You could also have a “Vehicles” table to store information about vehicles that people drive.

  • Items :

An item is a group of attributes that is uniquely identifiable among all of the other items.

Each table contains multiple items.

Items are similar to rows, records or tuples in relational database Systems.

In DynamoDB, there is no limit to the number of items you want to store in a table.

  • Attributes:

An attribute is a fundamental data element that does not need to be divided any further.

Each item is composed of one or more attributes.

Attributes in DynamoDB are similar in many ways to fields or columns.

For example: a Department item contain attributes such as DepartmentID, Name, Manager, and so on.

  • Primary Key:

A primary key in DynamoDB uniquely identifies each item in the table, so that no two items can have the same key.

When item is added, updated or deleted from the table, the primary key attribute values must be specify with that item.

The key values are required very important to add while creating database in DynamoDB.

DynamoDB consist of two type of primary keys: Partition keys & Partition key and Sort key

  • Primary Key, Partition key:

A simple primary key, composed of one attribute known as the partition key.

This partition key values that are input or output to an internal hash function are used to determines the partition where the item is stored.

With a simple primary key, no two items in a table can have the same partition key value.

  • Primary Key: Partition key and Sort key

A composite primary key, composed of two attributes: Partition key    and Sort key.

Partition key value is used to determine the partition where the item is stored using hash function.

Sort key value store all items in sorted order which have same partition key.

  • Primary Key:

The Partition key of an item is also known as its Hash Attribute.   (because of the service’s use of an internal hash function to evenly distribute data items across partitions, based on their partition key values.)

The Sort key of an item is also known as its Range Attribute.       (Because of the way DynamoDB stores items with the same partition key physically close together, in sorted order by the sort key value.)

  • Secondary Indexes:

A Secondary index is used to query the data in the table using an alternate key (in place of primary key).

DynamoDB supports two kinds of indexes:

  • Global secondary index – an index with a partition key and sort key that can be different from those on the table.
  • Local secondary index – an index that has the same partition key as the table, but a different sort key.

Amazon DynamoDB is set up in two ways

1.Setting up DynamoDB Local (Downloadable version)

2.Setting up DynamoDB (Web Service)

1.Setting up DynamoDB Local (Downloadable version)

The downloadable version of DynamoDB is used to write applications without accessing the actual Amazon DynamoDB web service.

In this, the database is self-contained on local computer.

This local version of DynamoDB help to save on provisioned throughput, data storage, and data transfer fees.

User doesn’t need an Internet connection while developing application.

The downloadable version of DynamoDB is provided as an executable .jar file. It will run on Windows, Linux, Mac OS X, and other platforms that support Java.

DynamoDB requires the Java Runtime Environment (JRE) version 6.x or newer on computer; it will not run on older JRE versions

DynamoDB is also available on Maven or as part of the AWS Toolkit for Eclipse

2.Setting up DynamoDB (Web Service)

To use the DynamoDB web service follow these steps:

1.Sign Up for AWS

2.Get Your AWS Access Key ID and Secret Key (used to access DynamoDB programmatically).

Amazon DynamoDB can be access by using the following method

1.Using Console

2.Using CLI

3.Using API

1.Using Console

To access the DynamoDB AWS Management Console https://console.aws.amazon.com/dynamodb/home

Console is used to access DynamoDB different features.

  • Overview – Shows Stream and Table details. Manage Streams and Time To Live (TTL).
  • Items – Manage items and perform queries and scans.
  • Metrics – Monitor your CloudWatch metrics.
  • Alarms – Manage CloudWatch alarms.
  • Capacity – Modify your table’s provisioned capacity.
  • Indexes – Manage Global Secondary Indexes (GSIs).
  • Triggers – Manage triggers to connect DynamoDB streams to Lambda functions.
  • Access control – Setup fine-grained access control with Web Identity Federation.
  • Tags – Apply tags to your resources to help organize and identify them.

2.Using CLI

DynamoDB AWS Command Line Interface (AWS CLI) is used to control multiple AWS services from the command line and automate them through scripts.

User can use the AWS CLI for ad hoc operations, such as creating a table and embed DynamoDB operations within utility scripts.

Before setting up the AWS CLI on computer, firstly get AWS Access Key ID and Secret Key (User IAM).

The AWS CLI is available at http://aws.amazon.com/cli, and will run on Windows, Mac, or Linux.

After downloading the AWS CLI, then install and configure it

3.Using API

User can write application code using the AWS SDKs.

The AWS SDKs provide broad support for DynamoDB in java, javascript in the browser, .NET, node.js, PHP, Python, Ruby, C++, Go, Android and iOS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s