Demo: Creating A Global Secondary Index

Creating a GSI with the table

Let’s go back to our MusicColection example. We want a table that can be used as a query for the following use cases:

  1. Creating a playlist of all the songs produced by a particular Artist.

  2. Creating a playlist of all the songs belonging to a Genre.

Now, this is a new table that we want to create. We can create the GSI while creating the table. We should keep Artist as the Partition Key for the Primary Key and Genre as the Partition Key for the Index Key. We should also allot appropriate throughput capacities.

Get hands-on with 1400+ tech skills courses.