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
- Goto AWS Main Console and Click Services
- In services section Click on DynamoDB
- you will be pop-uped with DynamoDB Console
- Click on Create Table
- 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)
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.
- Click Create. Your table will be ready not immediately but takes several seconds please be patient. once the database is created you get the below image on screen
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.
- Select the ITEM tab
- and select Create Item
- 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.
- 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 ).
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.
- 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
Step-3: Managing and Querying the table
- 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
- select the item with Year having a value of 2014.
- Click the Actions drop-down, and select Edit.
- For the Year attribute value, change 2014 to 2015.
- Click Save
- 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.
- 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.
- Deleting the Table is also an easy method. Just Click on Tables on the Left navigation pane, click Actions and select Delete Table
- Once you had clicked its pop-ups the confirmation message Click Delete to permanently remove the Music Table
In these steps we create a tables in DynamicDB Console.
Thanks for viewing the post.Please leave your valuable feedback in comments.