DynamoDB Flashcards
With DynamoDB you don’t have to worry about
Hardware provisioning, setup and configuration, replication, software patching, or cluster scaling.
DynamoDB is a _______ database.
NoSQL
How much amount of data can DynamoDB table store?
Any amount of data.
Two types of backup
- On-demand
2. Point-in-time recovery
With point-in-time recovery, how many days can you go back in time
35 days with per second granularity.
How is data made highly available and durable?
All of your data is stored on solid-state disks (SSDs) and is automatically replicated across multiple Availability Zones in an AWS Region, providing built-in high availability and data durability.
DynamoDB table terminology
Tables - items and attributes.
What uniquely identifies each item?
Primary key
_______ provides more flexible querying.
Secondary Index
Which attributes are schemaless in a DD table
Except Primary keys
DynamoDB supports nested attributes up to __ levels deep.
32
Types of primary keys
- Partition keys
2. Partition keys and sort key
A simple primary key, composed of one attribute is known as ___________________
Partition key
What is a composite key?
Composite key is made of two attributes - Partition key and sort key.
DynamoDB uses the partition key value as input to an _____________
internal hash function.
The output from the hash function determines the _______ in which the item will be stored.
partition
All items with the _________ value are stored together, in sorted order by _________.
same partition key, sort key value
The partition key of an item is also known as its ________
hash attribute
The sort key of an item is also known as its________
range attribute.
Each primary key attribute must be a ______________
scalar (meaning that it can hold only a single value)
The only data types allowed for primary key attributes are _____________________
string, number, or binary.
What is secondary index?
Secondary indexes are optional allows you to query data using alternate keys, in addition to the partition keys.
Types of secondary indexes.
- Global secondary index.
2. Local secondary index.
Secondary indexes quota
20 Global secondary indexes and 5 local secondary indexes.
How do you update indexes once tables are updated?
DD maintains indexes automatically.
What are DD streams?
DynamoDB Streams is an optional feature that captures data modification events in DynamoDB tables.
How does events appear in DD streams?
The data about DD events appear in the stream in near-real time, and in the order that the events occurred.
Each event is represented by a _________
stream record.
If you enable a stream on a table, DynamoDB Streams writes a stream record whenever _________ events occurs:
- New item is added
- An item is updated
- An item is deleted from table
Each stream record also contains the ______, _______ and __________
Name of the table, the event timestamp, and other metadata.
Stream records have a lifetime of _________ after that, they are automatically removed from the stream.
24 hours;
Table names and index names must be between____ and _____ characters long, and can contain only the following characters:
3 and 255; a-z; A-Z, 0-9, _, -, .
Attribute names must be at least ___characters long, but no greater than ____ long.
one; 64 KB
These attribute names must be no greater than 255 characters long -
- Secondary index partition key names.
2. Secondary index sort key names.
The minimum length of a string can be zero, if the attribute is not used as a key for an index or table, and is constrained by the maximum DynamoDB item size limit of _____
400 KB.
When your application writes data to a DynamoDB table and receives an _____________
HTTP 200 response (OK)
Data consistency
The data is eventually consistent across all storage locations, usually within one second or less.
DynamoDB supports ______________ and _________ reads.
eventually consistent and strongly consistent
Default read type
eventually consistent
Disadvantages of strongly consistent reads
- A strongly consistent read might not be available if there is a network delay or outage. In this case, DynamoDB may return a server error (HTTP 500).
- Strongly consistent reads may have higher latency than eventually consistent reads.
- Strongly consistent reads are not supported on global secondary indexes.
- Strongly consistent reads use more throughput capacity than eventually consistent reads.
DynamoDB uses __________, unless you specify otherwise
eventually consistent reads
What are the types of read/write capacity modes
- On-demand
2. Provisioned (default, free-tier eligible)
What is the purpose of capacity modes
Capacity modes decide how you are charged for read/write throughput and how you manage capacity.
How do you allocate capacity modes for LSIs?
LSIs inherit the capacity mode from the base table.
How to serve requests without capacity planning?
With on-demand capacity mode
How on-demand capacity mode charges for DD?
On-demand capacity mode offers pay-per-request for reads/writes.
How on-demand mode works?
When enabled, on-demand accommodates the workload as they ramp up and down.
DD tables that uses on-demand mode offers:
Single-digit millisecond latency, SLA commitment and security that DD already offers.
When is on-demand capacity mode good?
- You have new tables with unknown workloads
- You have unpredictable application traffic.
- You prefer the ease of paying for only what you use.
Default throughput on table, account and indexes for on-demand DD tables
40k read request units and 40k write request units per table. Per account and index quotas are not applicable for on-demand
Can you make a table on-demand once it is created?
Yes. You can enable on-demand mode either using create or update commands.
How often can you switch between capacity modes?
You can switch between read/write capacity modes once for every 24 hours.
How much read/write throughput do you specify for on-demand?
You don’t have to specify the read/write throughput for DD
How DD charges for reads for on-demand
For reads, upto 4KB data
- 1 RRU for one strong consistent read
- 1 RRU for one eventually consistent read
- 2 RRU for one transactional read.
- For items more than 4KB data, more RRUs are required.
How DD charges for writes for on-demand mode?
For writes, upto 1KB
- 1 WRU per 1KB write
- 2 WRU per transactional write upto 1KB
- For items more than 1KB, additional WRUs are required.
How does DD on-demand accommodate to previous peak traffic?
Given a new peak traffic volume, DD immediately accommodates double peak traffic volume. making it the new traffic peak and the former - previous traffic peak.
Given when on-demand is enabled, DD scales up and down as per the traffic peaks, does it experience throttling?
Throttling can occur if you exceed the double your previous peak within 30 minutes.
What are the previous peak settings for a DD table with newly created table with on-demand capacity mode?
The previous peak is 2,000 write request units or 6,000 read request units. You can drive up to double the previous peak immediately, which enables newly created on-demand tables to serve up to 4,000 write request units or 12,000 read request units, or any linear combination of the two.
What are the previous peak settings for a DD table with a updated table with on-demand capacity mode?
The previous peak is half the maximum write capacity units and read capacity units provisioned since the table was created, or the settings for a newly created table with on-demand capacity mode, whichever is higher. In other words, your table will deliver at least as much throughput as it did prior to switching to on-demand capacity mode.
Table Behavior while Switching Read/Write Capacity Mode
When you switch a table from provisioned capacity mode to on-demand capacity mode, DynamoDB makes several changes to the structure of your table and partitions. This process can take several minutes. During the switching period, your table delivers throughput that is consistent with the previously provisioned write capacity unit and read capacity unit amounts. When switching from on-demand capacity mode back to provisioned capacity mode, your table delivers throughput consistent with the previous peak reached when the table was set to on-demand capacity mode.
What is the throughput for provision mode
Specified through the number of reads and writes per second that you require for your application.
When is Provisioned mode is a good option
- You have predictable traffic
- You run application whose traffic ramps up gradually or traffic is consistent
- You can forecast capacity requirements to control costs.
How DD charges for writes for provisioned mode?
For writes, upto 1KB
- 1 WCU per 1KB write
- 2 WCU per transactional write upto 1KB
- For items more than 1KB, additional WRUs are required.
How DD charges for reads for provisioned mode?
For reads, upto 4KB data
- 1 RCU for one strong consistent read
- 1 RCU for one eventually consistent read
- 2 RCU for one transactional read.
- For items more than 4KB data, more RCUs are required.
When calling DescribeTable on an on-demand table, read capacity units and write capacity units are set to ___
0
For provisioned mode, __________ is the maximum amount of capacity that an application can consume from a table or index.
Provisioned throughput