1
Q

How do NoSQL databases scale? (direction)

A

Horizontally

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

What replication do you get out of the box with DynamoDB

A

Replication accross 3 AZ

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

How much can DynamoDB scale?

A

It can scale to massive workloads
Millions of requests per seconds
Trillions of rows
TBs of storage

All of it completely automatically

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

How does DynamoDB enable event driven programming?

A

By providing DynamoDB streams

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

Does DynamoDB provide the ability to create โ€œdatabasesโ€?

A

No, only tables (itโ€™s a fully managed service, DynamoDB โ€œisโ€ the DB)

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

How many rows can a DynamoDB table have?

A

Infinite

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

What must all tables have?

A

A primary key

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

What are the two types of primary key?

A

Simple primary key (partition key only)

Composite primary key (partition key + sort key)

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

What do each item in a DynamoDB table have?

A

Primary key

Attributes

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

What is the maximum size of an item in DynamoDB table?

A

400 KB

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

Do all items have to share the same attributes in DynamoDB table?

A

No, they can all have their own, all attributes are nullable

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

What data types are supported in DynamoDB tables?

A

Scalar Types
Document Types
Set Types

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

What Scalar Types are available?

A
String
Number
Binary
Boolean
Null
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What Document Types are available?

A

List

Map

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

What is the List type?

A

Ordered collection of values (Similar to JSON array, values donโ€™t have to be of the same type)

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

What is the Map type?

A

Unordered collection of name-value pairs (Similar to JSON object (actually ideal for the purpose of storing JSON objects in DynamoDB))

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

What Set Types are available?

A

String Set
Number Set
Binary Set

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

What is a String Set?

A

โ€œListโ€ of strings

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

What is a Number Set?

A

โ€œListโ€ of numbers

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

What is a Binary Set?

A

โ€œListโ€ of binaries

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

What is the role of the partition key in a DynamoDB table?

A

It defines the partition where the item is going to get stored

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

How to make sure that data is highly distributed in a DynamoDB table with a simple primary key?

A

By having diverse partition keys (primary keys)

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

How is data grouped when using the composite primary key in a DynamoDB table?

A

Grouped by partition key

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

What is another name given to the sort key?

A

Range key

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

What must be unique when using the simple primary key in a DynamoDB table?

A

Partition key

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

What must be unique when using the composite primary key?

A

The combination (partition key + range key)

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

What are the two pricing model of DynamoDB tables?

A

On-demand capacity

Provisioned capacity

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

How to get better rates when using provisioned capacity?

A

By purchasing reserved capacity (Similar to how reserved instances work in EC2)

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

What are the units used to configure the read and write throughput of provisioned capacity DynamoDB tables?

A

Read Capacity Units (RCU)

Write Capacity Units (WCU)

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

What does 1 WCU represent?

A

One write per second for an item up to 1 KB

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

What happens if you need to write an item which weights more than 1 KB?

A

More WCU are consummed

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

Exercice: We write 10 objects per seconds of 2 KB each, how many WCU do we need?

A

20 WCU

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

Exercice: We write 6 objects per second of 4.5 KB each, how many WCU do we need?

A

30 WCU

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

Exercice: We write 120 objects per minute of 2 KB each, how many WCU do we need?

A

4 WCU

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

What is the difference between strongly consistent reads and eventually consistent reads?

A

With strongly consistent reads you are sure that even if you read right after a write, you will get the data
With eventually consistent reads, you may not get the data if you read right after a write, but you will eventually get the data (if you request it later enough)

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

Why do we might not get the data if we do an eventually consistent read just after a write?

A

If we happen to read from an AZ where our written data has not yet been replicated, we might not find the data

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

By default, DynamoDB uses eventually consistent reads, how can we โ€œenableโ€ consistent read?

A

By setting the ConsistentRead parameter to true in our read request

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

What does 1 RCU represent?

A

One strongly consistent read per second, or two eventually consistent reads per second, for an item up to 4 KB in size

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

If the items read are larger than 4 KB, what will happen?

A

More RCU will be consummed

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

Exercice: We do 10 strongly consistent reads per seconds of 4 KB each, how many RCU are consummed?

A

We need 10 * 4 KB / 4 KB = 10 RCU

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

Exercice: We do 16 eventually consistent reads per seconds of 12 KB each how many RCU are consummed?

A

We need (16 / 2) * ( 12 / 4 ) = 24 RCU

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

Exercice: We do 10 strongly consistent reads per seconds of 6 KB each how many RCU are consummed?

A

We need 10 * 8 KB / 4 = 20 RCU (we have to round up 6 KB to 8 KB)

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

What does DynamoDB divide data into?

A

Partitions

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

How to compute the number of partions used by a DynamoDB table?

A

Capacity = (TOTAL RCU / 3000) + (TOTAL WCU / 1000)
Size = Total Size / 10 GB
Total partitions = CEILING(MAX(Capacity, Size))

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

How are WCU and RCU spread accross partitions?

A

Evenly

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

What error will you get if you exceed your RCU or WCU?

A

ProvisionedThroughputExceededExceptions

47
Q

What might be the reason for ProvisionedThroughputExceededExceptions ?

A

Hot keys/partitions (One partition is being read too many times)
Very large items (RCU/WCU consumption depends on size of items)

48
Q

What solutions can you try to resolve ProvisionedThroughputExceededExceptions ?

A

Exponential back off

Distribute partition keys as much as possible

49
Q

What can you try if you have a lot of reads in a single partition?

A

Use DynamoDB Accelerator (DAX)

50
Q

What is DAX?

A

Seamless cache for DynamoDB

51
Q

What is the default TTL in DAX?

A

5 minutes

52
Q

How many nodes can you have in a DAX cluster?

A

Up to 10

53
Q

In how many AZ should your DAX cluster nodes be?

A

Multi AZ replication (minimum 3 recommended for prod)

54
Q

What API allows you to write data to a DynamoDB table?

A

PutItem

UpdateItem

55
Q

What is the difference beteen PutItem and UpdateItem

A

PutItem creates an item or replaces an existing one

UpdateItem does a partial update of attributes

56
Q

What are conditional writes?

A

A way to write / update only if a certain condition is respected

57
Q

What API allows you to delete data in DynamoDB table?

A

DeleteItem

DeleteTable

58
Q

Can you do a conditional delete?

A

Yes

59
Q

What is cheaper/faster between DeleteItem and DeleteTable + CreateTable for deleting all items in a table?

A

DeleteTable

60
Q

What does BatchWriteItem allow you to do?

A

Do 25 PutItem and / or DeleteItem in one call

61
Q

What is the maximum size of the data written with BatchWriteItem

A

16 MB

62
Q

What is the maximum size of the data written PER ITEM with BatchWriteItem

A

400 KB

63
Q

What does BatchWriteItem batching provide you?

A

Reduction in latency (less API calls)

64
Q

What can you do if part of a batch fails with BatchWriteItem ?

A

Try the failed items (exponential back-off algorithm)

65
Q

What is the GetItem read based on?

A

Primary key

66
Q

How can you specify which attributes to get from an item read with GetItem?

A

Use the ProjectionExpression parameter

67
Q

How many items does BatchGetItem allow you to get?

A

Up to 100

68
Q

How many MB of data does BatchGetItem allow you to get?

A

Up to 16MB

69
Q

What is inefficient way of querying data in a dynamoDB table, and why so?

A

Scan, because it will โ€œaccessโ€ all the data in your table, therefore you will be charged for the entire weight of your table (up to 1 MB)

TODO: Make this answer clearer

70
Q

What is the efficient way of querying data in a DynamoDB table?

A

Using the Query API

71
Q

Query returns items based on?

A
Partition key (must be = operator)
Sort key (=,>,Between,Begin operator) (optional)
72
Q

How many MB of data can the Query API return?

A

Up to 1 MB

73
Q

Can you limit the number of items returned by the Query API?

A

Yes, with the Limit parameter

74
Q

What filtering method does not help you with lowering costs in DynamoDB?

A

FilterExpression

75
Q

Is pagination an option with Query API?

A

Yes

76
Q

Does Scan API consumes a lot of RCU?

A

Absolutely, and thatโ€™s why it is NOT efficient

77
Q

What are the two Scan API options which donโ€™t change the RCU consumption?

A

ProjectionExpression

FilterExpression

78
Q

How can you get faster performance when using the Scan API, and how does this impact RCU?

A

Parallel scans

+++ RCU consumption

79
Q

What does the DynamoDB Query API allow you to query other than tables?

A

Indexes

80
Q

What are DynamoDB LSI?

A

Local Secondary Index

Alternate range key for your table (local to the hash key)

81
Q

What are the available types for a sort key?

A

String, Number or Binary

82
Q

How many LSI can a DynamoDB table have?

A

Up to 5

83
Q

When must LSI be defined?

A

At table creation time

84
Q

What are DynamoDB GSI?

A

Global Secondary Index

Used to speedup queries on non-key attributes

85
Q

What is a DynamoDB GSI like?

A

A new โ€œtableโ€ linked to the base table

86
Q

How is called the group of attributes that are copied from a table to a secondary index?

A

A projection

87
Q

Once a DynamoDB table has been created, which can you add later? LSI or GSI?

A

GSI

88
Q

What must you define when creating a GSI (for the GSI specifically)?

A

Its own RCU and WCU

89
Q

What will happen if you perform heavy write activity on the table but the GSI does not have enough WCU?

A

The write activity on the BASE TABLE will be throttled

90
Q

What is the recommended WCU for a GSI to avoid potential throttling?

A

Equal or greater than the base table

91
Q

What are the special throttling considerations when dealing with LSI?

A

None

92
Q

What RCU/WCU does the LSI uses?

A

The ones of the main table

93
Q

DynamoDB features of conditional update / delete makes it an _________________ database

A

optimistic locking / concurrency

94
Q

Can you PutItem/BatchWriteItem on an GSI?

A

No! Itโ€™s an index, you can only write to a table.

95
Q

Why do GSI require WCU?

A

Base table needs to replicate (therefore write) to the GSI

96
Q

What is a DynamoDB Stream?

A

A stream which can be configured to record changes (Create, Update, Delete) in a DynamoDB table

97
Q

How long is the retention periods of messages in a DynamoDB stream?

A

24 hours

98
Q

What can DynamoDB streams be used for?

A

React to changes in real time (integration with Lambda)

Implement cross region replication

99
Q

What can you use to delete items of a DynamoDB table after a certain time?

A

Configure TTL in your DynamoDB table

100
Q

What does TTL stand for?

A

Time To Live

101
Q

What is the extra cost associated with TTL?

A

0$

102
Q

How many WCU does TTL consumes?

A

0

103
Q

Who operates TTL?

A

DynamoDB, you donโ€™t have to do anything than other than setting up your TTL attribute

104
Q

How can TTL help you reduce cost?

A

By deleting expired items, you free up space, therefore get charged less for storage

105
Q

What CLI options do you need to use to implement pagination in your DynamoDB/S3 queries?

A
  • -max-items

- -starting-token (If it is not the first call, you use the NextToken received in the previous call)

106
Q

What CLI option allow you to optimize your requests to avoid timeouts?

A

โ€“page-size

107
Q

What are DynamoDB transactions?

A

A new feature which give us the ability to create / update / delete multiple rows in different tables at the same time (all or nothing)

108
Q

How much WCU / RCU does transactions consume?

A

2 WCU per items of 1 KB

2 RCU per items of 4 KB

109
Q

Are there VPC endpoints to DynamoDB table?

A

Yes

110
Q

How is DynamoDB secure?

A

Access fully controlled by IAM
Encryption at rest using KMS
Encryption in flight using SSL / TLS

111
Q

What are the available backup / restore features offered by DynamoDB?

A

Point in time restore like RDS

112
Q

What are DynamoDB global tables?

A

Multi region, fully replicated, high performance tables

113
Q

What can you use to migrate from Mongo, Oracle, Mysql, etc. to DynamoDB?

A

Amazon DMS

114
Q

What does DMS stand for?

A

Database Migration Service