Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

AWS DynamoDB – Update Data in a Table

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

Amazon DynamoDB is a NoSQL managed database that supports semi-structured data i.e. key-value and document data. A DynamoDB table stores data in the form of an item. While creating a table in DynamoDB, a partition key needs to be defined which acts as the primary key for the table and no schema. Each item consists of attributes. By default, every item will have a partition key as one of the attributes. Every item can have a different number of attributes. An example of an item is given below:

  "Color": true,
  "Director": "Christopher Nolan",
  "MovieID": 1,
  "Name": "Inception",
  "Rating": 8.7,
  "Year": 2010

We will be doing the following operations in this article:

  1. Create a table in DynamoDB, say, Movies.
  2. Add items or data into the table.
  3. Update attribute of an item in the table.

The above approach has been implemented below:

Create Table and add Data :

  • Create a table named Movies with partition key as MoviesID. Add items to the table. A table has been already created for your reference. See the image below:

Update Data:

 There are two ways to update the attributes of an item. They are :

  • AWS CLI – In this, update-item is used to update the value of an attribute using Amazon Command Line Interface (CLI).
  • Amazon Management Console – To update the value of an attribute in items, navigate to the Items tab of a table and click on the MovieID to update the item. An edit item page will open to either add, update or delete a key-value pair. In the original table, the director column of MovieID=050 is empty. We are going to add ‘Christopher Nolan’ under the director attribute. See the below images:

Edit MovieID 050

Updated Table 

We observe that the director column of MovieID=050 has been updated with the value ‘Christopher Nolan’. Similarly, we can select any partition key and edit the value of the attribute of an item.

My Personal Notes arrow_drop_up
Last Updated : 28 Mar, 2023
Like Article
Save Article
Similar Reads
Related Tutorials