DynamoDB Flashcards

1
Q

DynamoDB

Amazon DynamoDB is a fast and flexible NoSQL database service for all applications that need consistent, single-digit millisecond latency at any scale. It is a fully managed database and supports both document and key-value data models. Its flexible data model and reliable performance make it a great fit for mobile, web, gaming, ad-tech, IoT, and many other applications.

A

DynamoDB

Amazon DynamoDB is a fast and flexible NoSQL database service for all applications that need consistent, single-digit millisecond latency at any scale. It is a fully managed database and supports both document and key-value data models. Its flexible data model and reliable performance make it a great fit for mobile, web, gaming, ad-tech, IoT, and many other applications.

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

DynamoDB

  • Stored exclusively on SSD storage to provide high I/O performance
  • Spread across 3 geographically distinct data centres
  • Eventual Consistent Reads (default)
    • Consistency across all copies of data is usually reached within a second. Repeating a read after a short time should return the updated data (Best read performance)
  • Strongly Consistent Reads
    • A strongly consistent read returns a result that reflects all writes that received a successful response prior to the read
A

DynamoDB

  • Stored on SSD storage
  • Spread across 3 geographically distinct data centres
  • Eventual Consistent Reads (default)
    • Consistency across all copies of data is usually reached within a second. Repeating a read after a short time should return the updated data (Best read performance)
  • Strongly Consistent Reads
    • A strongly consistent read returns a result that reflects all writes that received a successful response prior to the read
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

DynamoDB Basics

  • Tables
  • Items (think of a row of data in a table)
  • Attributes (think of a column of data in a table)
A

DynamoDB Basics

  • Tables
  • Items (think of a row of data in a table)
  • Attributes (think of a column of data in a table)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Primary Keys

Two types of Primary Keys available:

  • Single Attribute (think unique ID)
    • Partition Key (Hash Key) composed of one attribute.
  • Composite (think unique ID and a date range)
    • Partition Key & Sort Key (Hash & Range) composed of two attributes
A

Primary Keys

Two types of Primary Keys available:

  • Single Attribute (think unique ID)
    • Partition Key (Hash Key) composed of one attribute.
  • Composite (think unique ID and a date range)
    • Partition Key & Sort Key (Hash & Range) composed of two attributes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Partition Key

  • DynamoDB uses the partition key’s value as input to an internal hash function. The output from the hash function determines the partition (this is simply the physical location in which the data is stored).
  • No two items in a table can have the same partition key value.
A

Partition Key

  • DynamoDB uses the partition key’s value as input to an internal hash function. The output from the hash function determines the partition (this is simply the physical location in which the data is stored).
  • No two items in a table can have the same partition key value.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Partition Key and Sort Key

  • DynamoDB uses the partition key’s value as input to an internal hash function. The output from the hash function determines the partition (this is simply the physical location in which the data is stored).
  • Two items in a table can have the same partition key value, but they must have a different sort key.
  • All items with the same partition key are stored together, in sorted order by sort key value
A

Partition Key and Sort Key

  • DynamoDB uses the partition key’s value as input to an internal hash function. The output from the hash function determines the partition (this is simply the physical location in which the data is stored).
  • Two items in a table can have the same partition key value, but they must have a different sort key.
  • All items with the same partition key are stored together, in sorted order by sort key value
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
  • Local Secondary Index
    • Has the SAME partition key, different sort key
    • Can ONLY be created when creating a table. They cannot be removed or modified later.
  • Global Secondary Index
    • Has DIFFERENT Partition key and different sort key
    • Can be created at table creation or added LATER
A
  • Local Secondary Index
    • Has the SAME partition key, different sort key
    • Can ONLY be created when creating a table. They cannot be removed or modified later.
  • Global Secondary Index
    • Has DIFFERENT Partition key and different sort key
    • Can be created at table creation or added LATER
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Local VS Global Secondary Index

A

Local VS Global Secondary Index

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

DynamoDB Streams

Used to capture any kind of modification of the DynamoDB tables.

  • If a new item is added to the table, the stream captures an image of the entire item, including all of its attributes.
  • If an item is updated, the stream captures the “before” and “after” image of any attributes that were modified in the item.
  • If an item is deleted from the table, the stream catpures an image of the entire item before it was deleted
A

DynamoDB Streams

Used to capture any kind of modification of the DynamoDB tables.

  • If a new item is added to the table, the stream captures an image of the entire item, including all of its attributes.
  • If an item is updated, the stream captures the “before” and “after” image of any attributes that were modified in the item.
  • If an item is deleted from the table, the stream catpures an image of the entire item before it was deleted
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Query and Scans

  • A Query operation finds items in a table using only primary key attribute values. You must provide a partition key attribute name and a distinct value to search for.
  • A Scan operation examines every item in the table. By default, a Scan returns all of the data attributes for every item; however, you can use the ProjectionExpression parameter so that the Scan only returns some of the attributes, rather than all of them.
  • Try to use a Query operation over a Scan operation as it is more efficient.
A

Query and Scans

  • A Query operation finds items in a table using only primary key attribute values. You must provide a partition key attribute name and a distinct value to search for.
  • A Scan operation examines every item in the table. By default, a Scan returns all of the data attributes for every item; however, you can use the ProjectionExpression parameter so that the Scan only returns some of the attributes, rather than all of them.
  • Try to use a Query operation over a Scan operation as it is more efficient.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

DynamoDB Throughput

You have an application that requires to read 5 items of 10 KB per second using eventual consistency. What should you set the read throughput to?

  • First we calculate how many read units per item we need
  • 10 KB rounded up to the nearest increment of 4 KB is 12 KB
  • 12 KB / 4 KB = 3 read units per item
  • 3 x 5 read items = 15
  • Using eventual consistency we get 15/2 = 7.5
  • 8 units of read throughput
A

DynamoDB Throughput

You have an application that requires to read 5 items of 10 KB per second using eventual consistency. What should you set the read throughput to?

  • First we calculate how many read units per item we need
  • 10 KB rounded up to the nearest increment of 4 KB is 12 KB
  • 12 KB / 4 KB = 3 read units per item
  • 3 x 5 read items = 15
  • Using eventual consistency we get 15/2 = 7.5
  • 8 units of read throughput
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Write Throughput

You have an application that requires to write 12 items of 100 KB per item each second. What should you set the write throughput to?

  • Each write unit consist of 1 KB of data. You need to write 12 items per second with each item having 100 KB of data
  • 12 x 100 KB = 1200 write units
  • Write throughput of 1200 Units
A

Write Throughput

You have an application that requires to write 12 items of 100 KB per item each second. What should you set the write throughput to?

  • Each write unit consist of 1 KB of data. You need to write 12 items per second with each item having 100 KB of data
  • 12 x 100 KB = 1200 write units
  • Write throughput of 1200 Units
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Error Codes

400 HTTP Status Code - ProvisionedThroughputExceededException

You exceeded your maximum allowed provisioned throughput for a table or for one or more global secondary indexes.

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

Steps taken to authenticate

  • User authenticates with ID provider (such as Facebook)
  • They are passed a Token by their ID provider
  • Your code calls AssumeRoleWithWebIdentity API and provides the providers token and specifies the ARN for the IAM Role
  • App can now access DynamoDB from between 15 minutes to 1 hour (default is 1 hour)
A

Steps taken to authenticate

  • User authenticates with ID provider (such as Facebook)
  • They are passed a Token by their ID provider
  • Your code calls AssumeRoleWithWebIdentity API and provides the providers token and specifies the ARN for the IAM Role
  • App can now access DynamoDB from between 15 minutes to 1 hour (default is 1 hour)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly