Lab8: Introduction to Amazon DynamoDB

In this lab, I will demonstrate the following topics on Amazon DynamoDB:  

  • Create an Amazon DynamoDB table
  • Loading data into aa Amazon DynamoDB table
  • Querying Amazon DynamoDB
  • Deleting an Amazon DynamoDB table

Amazon DynamoDb is the NoSQL database service for all applications that requires high availability, resilience, scalable performance, single-digit millisecond latency at any scale. It is one of fast and flexible database service which is higher manageable capacity as well as it supports data models either it is document or key-value. Because of its flexible data model and reliable performance, most application platforms such as mobile, ad-tach, IoT, gaming etc are choosing it as their database service.

NoSQL database is the non-relational database’s system which provides high performance. The top most benefits are that NoSQL data model is full of variety data. It can handle document, key-value, graph, and column.

Steps for the task: Create an Amazon DynamoDB table

  1. Log in your Amazon Management console by your amazon user ID and password. Then click Service in the Amazon Management Console. Click “DynamoDB” from Database panel.1.jpg
  2. On the page of DynamoDB. Click “Create Table“. You will get provision for table creation on your DynamoDB services.

Suppose, You want to build a database system for a music search application and where you want to store your music data. Put your table name:  Music, Primary Key: Artist and add sort key: SongTitle. As you are going to put character data into the database, select the data type: String, and select table settings: default.

Note: Remember, Table name must be 3-255 Characters long and it could be the combination of character, number, and special characters.

*** The primary key is made up of a partition key (hash key) and an optional sort key. The partition key is used to partition data across hosts for scalability and availability. Choose an attribute which has a wide range of values and is likely to have evenly distributed access patterns. For example, Here, I selected Artist as my primary key. 

*** The sort key allows for searching within a partition. For example, Music table with primary attribute Artist and sort attribute SongTitle would allow for queries for all music by a specific artist in a given date range.


3. Click “Create“. Now your  Music table will be ready including “Read and Write” permission. 3.jpg

Steps for the task: Adding and Modifying TableData

In this step, I am going to add data into my newly created table: Music. In the DynamoDb, each table is made of “Attributes”. Whenever you will need to insert data into your table, you only require Primary key attributes. The wonderful part of DynamoDb is that You don’t need to think about schema except for primary, that means you do not need to entry same kind of attributes. You can add attributes to one item and that may be different than attributes of another item.

  1. Go to Item of the music table from DynamoDB page. Click  Create Item. A wizard will have appeared where you will able to add or modify attributes values. Suppose, I put Artist attribute value ” No one You Know” and SongTitle ” Call me Today”.

Note: The attribute type you declared during creating attribute is the string. You have to maintain data type, otherwise, you will get an error.5.jpg

2. If you want to add more attribute, click the plus sign to the left of the last attribute. A new attribute field will appear. You have to declares attribute name and value.  6.jpg

Here, I am going to add two more new attributes such as SongTite data type “String”,  and Year data type: Number. 7.jpg

3. After clicked “Save“. My first item is created. Now I am going to create two more items. If you want to add more items into your tables, repeating the steps that I did for creating first items. 8.jpg


If you insert three items into your music table, you will view the music table like my following screenshot.10.jpg

Steps for the task: Modify an Existing Item in the Table

In this task, you will exercise how to modify an existing item in the table. More often you may be required to change existing data in the production environment; It could have happened user error during data entry or some changes come after data inserted into the table.

  1. Click Tables from the left navigation Menu for viewing the list of the table under the DynamoDB page.
  2. Now click the radio button for selecting the music table. Click Items tab and select the item with the value of  year=2014, then click Edit from the Action tab.11.jpg
  3. You will get the Edit item wizard.Change the value of the year from 2014 to 2013 and click save. 12.jpg
  4. Now you can see the value of the year has changed for the item two.13.jpg

Steps for the task: Querying the table

The purpose of the query is to retrieve the necessary data from the table. In the Music table, we have three items attributes. In this lab, I will apply the queries against Music table. In this Music table, Artist is the primary key and SongTitle is the sort key.

The query I will do here for getting query output:

  1. Query using the Primary key to finding a specific Artist value = ‘No One You Know”. For using this query, click Tables from the left navigation menu for selecting the items list. Click the drop-down labelled Scan: [Table] Music: Artist, SongTitle. From the drop-down panel, change it scan to query. Query: [Table] Music: Artist, SongTitle.

a. Input the value in the partition key (Artist String and value) = No One You know. Then Click “Start Search“. The return query result will display the output of the artist who is “No One You Know”.

The output of query:

The return query result will display the output of the artist details with the songs title, album title and year of release who is “No One You Know”.14.jpg

2. Now I will do a query using Partition key and the sort key. I will apply this query to find songs by an artist (No One You Know)  and song title (Call Me Today)  with a specific String.

Input the partition key Artist String = No One You Know (Type in value box)

Input the sort key SongTitle String =Call Me Today

Click “Start Search”.

Query Result:

The Output of the query will display the track by the artist “No One You Know” and Title of the Song “Call me Tody” with Album title and year of release.


3. Find details Music record of an Artist “No One You Know” for the year of 2013.

Query Input:

Partition Key Artist = No One You Know”, Clear the sort key value because now you will filter the query by year.

Click Add Filter. In the new filter, Enter Attribute “Year”, data type String and Enter value =2013.

Year Number = 2013

Query Result

The query will return the Music record for that Artist “No One You Know” music record for the year 2013 with Song title and Album title.16.jpg

This is the query process to retire information from a table. You can add more filter to get the more specific result.

Steps for the Table:  Deleting the table

In this step, I will show how to delete a table from DynamoDb Database. I will delete the table Music” with all the data that contains by Music table.

  1. First, you need to click table from left navigator table under DynamoDB dashboard. Now Come to the table list.Click the radio button for selection the Music table (which one you want to delete). Go to Action  Manu, then click Delete Table. After few second, your table will be deleted. Note: Be careful deleting Table in the production environment. Keep your backup before deleting, editing, changing any attribute, table or item.17.jpg

Question: What is a data model? What is the difference between SQL and NoSQL data model structure? 

A data model is an abstract model that organises segment of data and standardises how they built the connection with one another and to features of the real entities.

The relational model normalises data into tabular structures known as tables, which consist of rows and columns. A schema strictly defines the tables, columns, indexes, relationships between tables, and other database elements.

Non-relational (NoSQL) databases typically do not enforce a schema. A partition key is generally used to retrieve values, column sets, or semi-structured JSON, XML, or other documents containing related item attributes.

Cost Analysis:

Payment Method: The price structure for the DynamoDB is paid only for what you use. No minimum fee is there.

You can calculate your estimated minimum fee by using AWS simple Monthly Calculator (

Free Tier offer: 

DynamoDB customers get 25 GB of free storage, as well as up to 25 write capacity units and 25 read capacity units of ongoing throughput capacity up to 200 million requests per month and 2.5 million read requests from DynamoDB Streams for free.

Reserved capacity: A bill feature for DynamoDB users in AWS platform that allow you to obtain discount on provision throughput capacity in exchange for the following condition

  • A one-time up-front payment
  • A commitment to a minimum monthly usage level for the duration of the term of the agreement.

Note: Reserved Capacity applies within a single AWS Region and can be purchased with 1-year or 3-year terms. Throughput capacity provision is associated with every DynamoDb table.

Region: US West (Oregon) (Data collection March 2017, Source: AWS Cloud Price)

  • Write Throughput: $0.0065 per hour for every 10 units of Write Capacity
    (enough capacity to do up to 36,000 writes per hour)*
  • Read Throughput: $0.0065 per hour for every 50 units of Reading Capacity
    (enough capacity to do up to 180,000 strongly consistent reads, or 360,000 eventually consistent reads, per hour)
  • Indexed Data Storage:
    • First, 25 GB stored per month is free
    • $0.25 per GB-month thereafter
  • DynamoDB Streams
    • Every month, the first 2.5 million DynamoDB Streams read request units are free
    • $0.02000 per 100,000 DynamoDB Streams read request units thereafter

Calculation of pricing:

Suppose, If you create a DynamoDb table which requires 20 unit of write capacity and 300 units of read capacity of throughput provision and you are US West (Oregon region).

Your charged will be per hour = $0.0065 *2 + (6*$0.0065) = $0.052 per hour.

If you change your throughput and increase reserved throughput that is 20,000 units of Write and 80,000 unit of reading capacity, your bill would be

If your throughput needs changing and you increased your reserved throughput requirement to 20,000 units of write capacity and 50,000 units of reading capacity, your bill would per hour: (2,000 x $0.0065) + (1,000 x $0.0065) = $19.5/hour

Note: Your per hour bill always calculating based on your Read and Write throughput. Your bill will increase and decrease based on provisioned throughput.

Data Transfer  Price:


Suppose, your data transfer in per month is 500 and out is 300 GB, The estimated bill you have to pay for this service is: $43.65. Price can be varied region to region.

Some additional factors you need to consider during calculating database related cost:

  • Database Administrative cost
  • Redundancy cost
  • Maintenance and operating cost

Running NoSQL database software in the cloud significantly reduces infrastructure costs. In the cloud, those costs include instance hours, GB-month of storage, I/O requests, and data transfer.

Thank you 🙂



Leave a Reply

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

You are commenting using your 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