Introduction to Amazon DynamoDB: Lab Instruction

Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability. You can use Amazon DynamoDB to create a database table that can store and retrieve any amount of data, and serve any level of request traffic. Amazon DynamoDB automatically spreads the data and traffic for the table over a sufficient number of servers to handle the request capacity specified by the customer and the amount of data stored, while maintaining consistent and fast performance.

Steps involved in creating a new database table using DynamoDB Console

In this Lab we will see

  • creating the tables
  • adding items to the database
  • modifying the items
  • deleting the tables

Step-1: Creating the table

  1. Goto AWS Main Console and Click Services
  2. In services section Click on DynamoDB 
  3. you will be pop-uped with DynamoDB Console
  4. Click on Create TableAmazon-DynamoDB-1438723482 
  5. you will see a window pop-up with Table Name (should be unique name)and a Primary key, where the Primary key is categorized into two sections Partition key and Sort key. These keys acts as filter objects in finding the item in a huge database. In my post am creating a music items where Partition key are Artists and Sort key as SongTiTle(no spaces)
  6. In Primary Key, type Artist and select String.Click Add Sort Key and in the new field type SongTitle (no spaces) and leave String selected.In the Table Settings page, leave Use default settings selected.

  7. Click Create. Your table will be ready not immediately but takes several seconds please be patient.                                                                               2                                                                                                                               once the database is created you get the below image on screen            3

Step-2 :Adding and Modifying the Table Data                                                       Data items in the database are stored as attributes. As the data entered into the DynamicDB ,Primary key is main requirement in saving the item. Other than the primary key, the table does not require a schema. This means that you can add attributes to one item that may be different than another item’s attributes.      7

  1. Select the ITEM tab
  2. and select Create Item  
  3. In the Artist attribute (of type String), enter Katty Perry in the VALUE field.
    In the SongTitle attribute (also of type String),  enter Roar in the VALUE field.                                                                                                                  5
  4. we can add more attributes in item.                                                             For example in this lab we create an additional attribute,  Click the plus sign to the left of the last attribute (SongTitle) and then click Append.In the drop-down list select the String type and a new attribute row will be added.

    For the new attribute enter the below values:
    a. In the FIELD box (the element name): enter AlbumTitle.
    b. In the VALUE box: enter Prism.
    Create another new attribute:, again click the box to the left of the last attribute (now AlbumTitle ).
    Click Append.

    In the drop-down list select Number and a new attribute will be added.

    For the new attribute enter the following values:
    a. In the FIELD box (the element name): enter Year.
    b. In the VALUE box: enter 2015.
    Click Save to store the new Item with its four attributes.                                   6

  5. Try to save 3-4 items in the database with different artists,songs and albums. Once you had created you can see these items like below screen                                                                                                                                                                                                          8

Step-3: Managing and Querying the table

  1. you can mange the data item in the database in this steps  goto DynamicDB Console and Click on Music and Click on the Items tab
  2.  select the item with Year having a value of 2014.
  3.  Click the Actions drop-down, and select Edit.                                                               9
  4.  For the Year attribute value, change 2014 to 2015.
  5. Click Save

     

  6. Querying table is searching the item from the database. The search option are specified on the Music , the table primary key is made of Artist (partition key) and SongTitle (sort key).                                    Click Tables from the left navigation menu to return to the list of tables.
    Click the radio button next to the Music table to select it.
    Click the Items tab.
    Click the drop-down labeled Scan [Table] Music: Artist, SongTitle, and on the revealed panel, use the drop-down to change Scan to Query.                                                                                                                                   11
  7. Add attributes details in the scan box and click on Start Search. You can add more search filter rows for an exact search as shown below.    1213
  8.  Deleting the Table is also an easy method. Just Click on Tables on the Left navigation pane, click Actions and select Delete Table             
  9. Once you had clicked its pop-ups the confirmation message Click Delete to permanently remove the Music Table                               141516

In these steps we create a tables in DynamicDB Console.

Thanks for viewing the post.Please leave your valuable feedback in comments.

Advertisement

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 )

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