DBS-C01 · Question #297
A company uses Amazon DynamoDB as a data store for multi-tenant data. Approximately 70% of the reads by the company's application are strongly consistent. The current key schema for the DynamoDB…
The correct answer is C. Create a new table with the specified partition and sort key. Create an AWS Glue ETL job to. To change a DynamoDB table's primary key (partition and sort key) while maintaining existing data and supporting strongly consistent reads, a new table must be created with the desired key schema, and data must be migrated using an ETL process.
Question
A company uses Amazon DynamoDB as a data store for multi-tenant data. Approximately 70% of the reads by the company's application are strongly consistent. 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?
Options
- ACreate a global secondary index (GSI) on the existing table with the specified partition and sort
- BCreate a local secondary index (LSI) on the existing table with the specified partition and sort key.
- CCreate a new table with the specified partition and sort key. Create an AWS Glue ETL job to
- DCreate a new table with the specified partition and sort key. Use AWS Database Migration
How the community answered
(22 responses)- A9% (2)
- B9% (2)
- C59% (13)
- D23% (5)
Why each option
To change a DynamoDB table's primary key (partition and sort key) while maintaining existing data and supporting strongly consistent reads, a new table must be created with the desired key schema, and data must be migrated using an ETL process.
A Global Secondary Index (GSI) can have a different partition and sort key than the base table, but queries against GSIs only support eventually consistent reads by default, which does not meet the requirement for strongly consistent lookups.
A Local Secondary Index (LSI) must share the same partition key as the base table, which would not allow for the desired `OrgID#TenantID` partition key, and also cannot be added or modified after table creation if it involves changing the partition key.
The primary key (partition and sort key) of an Amazon DynamoDB table cannot be changed after creation, thus requiring a new table with the desired `OrgID#TenantID` partition key and `Version` sort key. An AWS Glue ETL job can efficiently migrate existing data from the old table to the new one, accommodating the data transformation needed for the new key structure and supporting strongly consistent lookups.
While AWS DMS can migrate data between DynamoDB tables, an AWS Glue ETL job is often more suitable for data transformation and schema changes between DynamoDB tables, especially when a direct key schema change is involved, compared to the general migration capabilities of DMS.
Concept tested: DynamoDB primary key modification and data migration
Source: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.CoreComponents.html#HowItWorks.CoreComponents.PrimaryKey
Topics
Community Discussion
No community discussion yet for this question.