DynamoDB Flashcards

1
Q

How is DynamoDB replicated?

A

By default, DynamoDB is fully managed and replicated across 3 Availability Zones.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you enable Event Driven programming in DynamoDB?

A

Use DynamoDB Streams

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the max size of an item/row in DynamoDB?

A

400KB

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What data types are supported in DynamoDB?

A
  • Scalar Types: String, Number, Binary, Boolean, Null
  • Document Types: Map, List
  • Set Types: String Set, Binary Set, Number Set
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is your first option for a primary key?

A

A Unique Hash Key / Partition Key

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is your second option for a primary key?

A

A combination of partition key and a sort key

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the sort key also known as?

A

Range key

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is RCU?

A

Read Capacity Units: throughput for reads

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is WCU?

A

Write Capacity Units: throughput for writes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Why would you get a “ProvisionedThroughputException”?

A

If you have temporarily exceeded your throughput limit and used all of the available burst credits.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What should you do if you get a “ ProvisionedThroughputException”?

A

Use an exponential backoff

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Why would you get a “ProvisionedThroughputExceeded Exception”?

A

Hot keys, too many requests to the same partition or very large items exceeding the WCU/RCU.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What can be done to resolve a “ProvisionedThroughputExceeded Exception”?

A
  • Exponential backoff
  • Distributed partition keys
  • Dynamo Accelerator (DAX)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What can you do to prevent ProvisionedThroughputExceeded Exceptions

A

Use Auto Scaling to increase WCU/RCU depending on activity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What command will write to Dynamo

A

PutItem

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What command will update an item

A

UpdateItem

17
Q

How do you deal with concurrency with regards to writes?

A

Use Conditional Writes

18
Q

How do you remove from Dynamo

A

DeleteItem

19
Q

How do you do batch writes in Dynamo?

A

BatchWriteItem

20
Q

How many items can you write/delete in one PutItem/DeleteItem call for batches?

A

25

21
Q

What is the item size limit in a batch?

A

400KB

22
Q

What is the data limit that can be written in one Batch call?

A

16MB

23
Q

What happens when a batch items fails?

A

It is up to me to retry

24
Q

How can you query in Dynamo?

A
  • Query on exact partitionKey

- Optional Sort Key (=, , >=, BETWEEN, BEGIN)

25
Q

What does a query return?

A

Up to 1MB of data with a limit if specified

26
Q

What is LSI in Dynamo?

A

Local Secondary Index, which is an alternate range key for your table

27
Q

How many LSI can you have per table?

A

Up to 5

28
Q

What does the sort key consist of?

A

One scalar attribute (String, Number, Binary)

29
Q

When do you declare an LSI?

A

At table creation stage

30
Q

What is a GSI?

A

Global Secondary Index which is a partition key and an optional sort key, resulting in a new table that we can assign attributes to

31
Q

What can go in a DynamoDB Stream?

A

Most changes like Create/Update/Delete

32
Q

What can read a DynamoDB Stream?

A

Lambda

33
Q

What is the data retention in DynamoDB Streams

A

24 hours

34
Q

How do you calculate WCU?

A

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)

35
Q

What about items larger than 1KB?

A

More WCUs are used

- If we write 6 4.5KB items per second, we need 30WCUs (6 x 5: 4.5 gets rounded up.)

36
Q

How do you calculate RCU?

A

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.