DynamoDB Flashcards
What is Amazon DynamoDB?
Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability.
DynamoDB also offers encryption at rest, why is this a benefit to AWS Customers?
Encryption at rest eliminates the operational burden and complexity of protecting sensitive data.
DynamoDB provides on-demand backup capability.
Which creates full backups of your tables for which two purposes?
DynamoDB allows you to create full backups of your tables for long-term retention and archival for regulatory compliance needs
How does DynamoDB provide built-in high availability and data durability?
All of your data is stored on solid-state disks (SSDs) and is automatically replicated across multiple Availability Zones in an AWS Region,
Describe global tables purpose in relation to DynamoDB?
You can use global tables to keep DynamoDB tables in sync across AWS Regions.
What are the three Core components of Amazon DynamoDB?
In DynamoDB, tables, items, and attributes are the core components that you work with.
How do tables, items, and attributes work together?
A table is a collection of items, and each item is a collection of attributes.
Describe how DynamoDB uses primary keys.
What features does the addition of secondary indexes provide you in DynamoDB
DynamoDB uses primary keys to uniquely identify each item in a table.
DynamoDB uses secondary indexes to provide more querying flexibility.
DynamoDB: What is a table?
A table is a collection of data.
For example, a table called People that you could use to store personal contact information about friends, family, or anyone else of interest.
DynamoDB: What is an item?
An item is a group of attributes that is uniquely identifiable among all of the other items.
In a People table, each item represents a person.
Items in DynamoDB are similar to ____ in other database systems.
Items in DynamoDB are similar to rows in other database systems.
DynamoDB: What are attributes?
Each item within a table is composed of one or more attributes.
For example, an item in a People table contains attributes like PersonID, LastName, FirstName, and so on.
Attributes in DynamoDB are similar in many ways to ______ or _________ in other database systems.
Attributes in DynamoDB are similar in many ways to fields or columns in other database systems.
What does it mean when someone says your table is schemaless?
Schemaless means that neither the attributes nor their data types must be defined beforehand. Each item can have its own distinct attributes.
What is an example of a nested attribute?
Some of the items have a nested attribute (Address). DynamoDB supports nested attributes up to 32 levels deep.
Take a look at the address in this example.
When you create a table, in addition to the table name, you must specify the
primary key of the table
What is the function of the primary key?
The primary key uniquely identifies each item in the table so that no two items can have the same key.
DynamoDB supports two different kinds of primary keys:
Simple Primary Key aka Partition Primary Key
and a Composite Primary Key
What are the components of a Simple Primary key?
A Simple primary key is made up of one attribute known as the partition key.
What happens if you try to add two items with the same partition key value in a table with a Simple Primary key setup?
No two items can have the same partition key value in a table with only a partition key. You will get an error.
What are the components of a Composite Primary key?
A Composite Primary Key is composed of two attributes:
Partition key and Sort key
Explain how Composite Primary Key differs from a Partition Primary Key.
In a table that has a (Partition key and a Sort key = Composite Primary Key) it’s possible for multiple items to have the same partition key value. However, those items must have different sort key values.
How are items in a table sorted when using a Composite Primary Key?
All items with the same partition key value are stored together, in ascending order by sort key value.
What type of flexibility does Composite Primary Key give you when querying data?
For example, if you provide only the value for Artist, DynamoDB retrieves all of the songs by that artist. To retrieve only a subset of songs by a particular artist, you can provide a value for the Artist and a range of values for SongTitle.
The partition key of an item is also known as its
hash attribute.
A partition key notes where the data will be stored in the data base
The sort key of an item is also known as its range attribute. Where is the term range derived from?
The term range attribute derives from how DynamoDB stores items with the same partition key physically close together, in sorted order by the sort key value.
A sort key is a way to represent what type of relationship?
A sort key is a way to represent a 1:many relationship
What is the purpose of a secondary index?
A secondary index lets you query the data in the table using an alternate key
DynamoDB supports two kinds of indexes:
Global secondary index
Local secondary index
What are the features of a Global secondary index
An index with a partition key and sort key that can be different from those on the table.
What are the features of a Local secondary index
An index that has the same partition key as the table, but a different sort key.
DynamoDB Streams is an optional feature that captures what?
DynamoDB Streams is an optional feature that captures data modification events in DynamoDB tables.
DynamoDB Streams data about events that appear in the stream in near-real time and in the
the order that the events occurred
If you enable a stream on a table, DynamoDB Streams writes a stream record whenever one of the following events occurs: (3)
A new item is added to the table:
An item is updated:
An item is deleted from the table:
What does a DB stream capture when A new item is added to the table:
The stream captures an image of the entire item, including all of its attributes.
What does a DB stream capture when An item is updated:
The stream captures the “before” and “after” images of any attributes modified in the item.
What does a DB stream capture when an item is deleted?
The stream captures an image of the entire item before it was deleted.
Stream records have a lifetime of __ hours; after that, period of time what happens to them?
Stream records have a lifetime of 24 hours; after that, they are automatically removed from the stream.
Control plane operations let you ______ and ______ DynamoDB tables.
Control plane operations let you create and manage DynamoDB tables.
What are 5 Control Pane operations aka API calls?
-CreateTable – Creates a new table.
-DescribeTable– Returns information about a table
-ListTables – Names of all of your tables in a list.
-UpdateTable – Modifies the settings of a table or its indexes, creates or removes new indexes on a table, or modifies DynamoDB Streams settings for a table.
-DeleteTable – Removes a table and all of its dependent objects
Classic API for Creating data
What does ‘PutItem’ command execute?
Writes a single item to a table. You must specify the primary key attributes, but you don’t have to specify other attributes.
Classic API for Creating data
What does ‘BatchWriteItem’ command execute?
BatchWriteItem – Writes up to 25 items to a table. Can also be used for deleting multiple items from one or more tables.
What are Amazon DynamoDB two read/write capacity modes for processing reads and writes on your tables:
On-demand
Provisioned (default, free-tier eligible)
What does the read/write capacity mode control? (2)
The read/write capacity mode controls how you are charged for read and write throughput and how you manage capacity.
When can you set the read/write capacity mode on a table? (2)
You can set the read/write capacity mode when creating a table or you can change it later.
When should you use on-demand pricing with DynamoDB? (3)
New tables with unknown workloads.
Unpredictable application traffic.
You prefer the ease of paying for only what you use.
In a DynamoDB table, what is the upper limit on the number of distinct sort key values per partition key value?
There is no upper limit on the number of distinct sort key values per partition key value.
If you need to store billions of Dog names to a partition key for Dogs with a sort key names in a Pets table. Then DynamoDB would allocate enough storage to handle this requirement automatically.
1 read capacity unit represents how many strongly consistent & eventually consistent reads per second for up to how many kbs?
1 read capacity unit (RCU) = 1 strongly consistent read of up to 4 KB/s or 2 eventually consistent reads of up to 4 KB/s per read.
Transactional read requests require how many read capacity units to perform one read per second for items up to 4 KB?
Transactional read requests require two read capacity units to perform one read per second for items up to 4 KB.
2 RCUs = 1 transactional read request (one read per second) for items up to 4 KB.
What happens to reads on items greater than 4kbs?
For reads on items greater than 4 KB, the total number of reads required = (total item size / 4 KB) rounded up.
Write Capacity Unit: On-Demand Mode DynamoDB charges you for the writes that your application performs on your tables in terms of
write request units.
2 WRUs = how many transactional write requests (one write per second) for items up to 1 KB?
For writes greater than 1 KB, total number of writes required = ?
2 WRUs = 1 transactional write request (one write per second) for items up to 1 KB.
For writes greater than 1 KB, total number of writes required = (total item size / 1 KB) rounded up
1 write request unit (WRU) = 1 write of up to 1 KB/s.