The current key schema for the DynamoDB table is as follows:Partition key: OrgID -Sort key: TenantID#Version -Due to a change in design and access patterns, the company needs to support strongly consistent lookups based on the new schema below:Partition key: OrgID#TenantID -Sort key: Version -How can the database specialist implement this change?
Create a global secondary index (GSI) on the existing table with the specified partition and sort key.
Create a local secondary index (LSI) on the existing table with the specified partition and sort key.
Create a new table with the specified partition and sort key. Create an AWS Glue ETL job to perform the transformation and write the transformed data to the new table.
Create a new table with the specified partition and sort key. Use AWS Database Migration Service (AWS DMS) to migrate the data to the new table.
Explanations:
A Global Secondary Index (GSI) does not support strong consistency for reads, so it cannot satisfy the need for strongly consistent lookups.
A Local Secondary Index (LSI) allows strongly consistent reads, but it can only be created when the table is initially created. It cannot be applied to an existing table with a different key schema.
Creating a new table with the desired schema and migrating data with an ETL job is the correct approach because the schema change is not supported directly on an existing table. AWS Glue can handle the transformation and migration of data to the new schema.
AWS Database Migration Service (DMS) is typically used for migrating data between different database engines. It’s not ideal for migrating data within DynamoDB, and it doesn’t handle schema changes in DynamoDB tables.