AWSTemplateFormatVersion: ĭescription: AWS CloudFormation Template To Create a DynamoDB With GSIĭescription: Table Created using this template. We are also adding two Global Secondary Indexes named Location-index and Department-index. In this template we are specifying a table Employee with primary key as EmployeeId. Template to Create DynamoDB table with Global Secondary Index using CloudFormation JSON Either you provide ProvisionedThroughput RCU, WCU values on base table and GSI both or make BillingMode on base table to be PAY_PER_REQUEST and don’t specify ProvisionedThroughput anywhere. Note: Please note that when BillingMode is set to PAY_PER_REQUEST, you can not specify ProvisionedThroughput. Attribute3 How does a GSI look in a CloudFormation template? Resources: Note: When Projection attribute is set to INCLUDE, this is how you need to write it down in the template.
![local dynamodb gui local dynamodb gui](https://www.knime.com/sites/default/files/2-amazons3-meets-dynamodb.png)
Projection: The attributes that you would like to project on your GSI.IndexName: Name of your index, must be unique across indexes on this table.You can create maximum of 20 global secondary indexes on a table Things you need to specify while creating DynamoDB table with GSI using CloudFormation?.You can create a GSI at the time of table creation or later.Ideally your GSI can span across partitions in the base table and thus justifies the name global. It can help you speed up queries on non key attributes thus providing you better flexibility while querying your data. GSI is an index with a partition key and sort key(optional) that can be different from the base table. Let’s cover a bit of Global Secondary Index or GSI here. You can read about secondary indexes in more details here. In DynamoDB, If you want to perform query on a non key attribute, you need to create secondary index.
![local dynamodb gui local dynamodb gui](https://miro.medium.com/max/1400/1*WhXH8bHOotWr9cItkw5aOg.png)
Technically my aim for the post is to help you create a DynamoDB table with Global Secondary Index using CloudFormation.Īpart from that, I will let you know few issues that you may encounter while adding GSI using CloudFormation and their solutions.īefore we prepare our template, Let’s start with understanding GSI. Well, I wanted to give GSI special attention as there are a lot to talk about them. Back then, I didn’t cover Global Secondary Indexes or GSI.
#Local dynamodb gui how to
How to Create DynamoDB table with Global Secondary Index using CloudFormation?įew days ago, I wrote a post on Creating a DynamoDB table using CloudFormation.