DynamoDB COPY Flashcards
How is DynamoDB replicated?
By default, DynamoDB is fully managed and replicated across 3 Availability Zones.
How do you enable Event Driven programming in DynamoDB?
Use DynamoDB Streams
What is the max size of an item/row in DynamoDB?
400KB
What data types are supported in DynamoDB?
- Scalar Types: String, Number, Binary, Boolean, Null
- Document Types: Map, List
- Set Types: String Set, Binary Set, Number Set
What is your first option for a primary key?
A Unique Hash Key / Partition Key
What is your second option for a primary key?
A combination of partition key and a sort key
What is the sort key also known as?
Range key
What is RCU?
Read Capacity Units: throughput for reads
What is WCU?
Write Capacity Units: throughput for writes
Why would you get a “ProvisionedThroughputException”?
If you have temporarily exceeded your throughput limit and used all of the available burst credits.
What should you do if you get a “ ProvisionedThroughputException”?
Use an exponential backoff
Why would you get a “ProvisionedThroughputExceeded Exception”?
Hot keys, too many requests to the same partition or very large items exceeding the WCU/RCU.
What can be done to resolve a “ProvisionedThroughputExceeded Exception”?
- Exponential backoff
- Distributed partition keys
- Dynamo Accelerator (DAX)
What can you do to prevent ProvisionedThroughputExceeded Exceptions
Use Auto Scaling to increase WCU/RCU depending on activity
What command will write to Dynamo
PutItem
What command will update an item
UpdateItem
How do you deal with concurrency with regards to writes?
Use Conditional Writes
How do you remove from Dynamo
DeleteItem
How do you do batch writes in Dynamo?
BatchWriteItem
How many items can you write/delete in one PutItem/DeleteItem call for batches?
25
What is the item size limit in a batch?
400KB
What is the data limit that can be written in one Batch call?
16MB
What happens when a batch items fails?
It is up to me to retry
How can you query in Dynamo?
- Query on exact partitionKey
- Optional Sort Key (=, , >=, BETWEEN, BEGIN)
What does a query return?
Up to 1MB of data with a limit if specified
What is LSI in Dynamo?
Local Secondary Index, which is an alternate range key for your table
How many LSI can you have per table?
Up to 5
What does the sort key consist of?
One scalar attribute (String, Number, Binary)
When do you declare an LSI?
At table creation stage
What is a GSI?
Global Secondary Index which is a partition key and an optional sort key, resulting in a new table that we can assign attributes to
What can go in a DynamoDB Stream?
Most changes like Create/Update/Delete
What can read a DynamoDB Stream?
Lambda
What is the data retention in DynamoDB Streams
24 hours
How do you calculate WCU?
One write request unit represents one write for an item up to 1 KB in size. If we write 10 2KB items per second, we need 20WCU (10 x 2)
What about items larger than 1KB?
More WCUs are used
- If we write 6 4.5KB items per second, we need 30WCUs (6 x 5: 4.5 gets rounded up.)
How do you calculate RCU?
One read request unit represents one strongly consistent read request, or two eventually consistent read requests, for an item up to 4 KB in size.