Search code examples
amazon-web-servicesamazon-dynamodb

Create GSI in DynamoDB for JSON Objects - AWS Console


Is it possible to create Global secondary index on JSON objects?

for example:

UserId: uuid CreatedDate: timestamp Details: Map

and Details will be:

{"name":"Alex","age":40,"weight":"70"}

I want to make a query on age property. Is it possible? if yes how we can create it on AWS Console?


Solution

  • No, you can't create a GSI on JSON Objects. The AWS documentation states:

    Each index key attribute must be a scalar of type String, Number, or Binary. (It cannot be a document or a set.)

    This is the link to the documentation page https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.OnlineOps.html#GSI.Creating.