Create DynamoDB Table
Overview
In this step, you will create a DynamoDB Table to store invoice information after it is processed by the Lambda function. The table will use on-demand mode and have 2 additional Global Secondary Indexes (GSIs) to support queries by customer name and starred invoices.
Step 1: Access DynamoDB Console
- Log in to AWS Console, search for DynamoDB, then select DynamoDB in the results.

💡 Note: Before clicking Create table, make sure you have selected the correct region as US East (N. Virginia) (us-east-1) in the upper right corner of the AWS Console screen.
- Click Create table to start creating a new table.

Table name: InvoiceData
Partition key:
- Name:
InvoiceId - Type:
String
- Skip the Sort key section (not necessary).

- In the Table settings section, Select Default settings to switch to On-demand capacity mode.

- Click Create table to finish.

Step 3: Add Global Secondary Index (GSI)
Once the InvoiceData table is successfully created, you will add two secondary indexes:
GSI #1: CustomerName-index
- In the table details page, select the Indexes tab.

- Click Create index.

- Configuration:
- Partition key:
CustomerName - Data type: String
- Sort key: (leave blank)
- Projected attributes: select All


- Click Create index.

GSI #2: StarredInvoicesIndex
- Click Create index again to create the second GSI.

- Configuration:
- Partition key:
IsStarred (type String) - Sort key:
CreatedAt (type String) - Index name:
StarredInvoicesIndex - Projected attributes: select All


- Click Create index.

- Make sure both GSIs CustomerName-index and StarredInvoicesIndex are in ACTIVE status before continuing with Lambda function configuration.

⚠️ If the GSI status is still Creating, you need to wait a few minutes until it changes to Active before making a query or deploying a Lambda to access the GSI.