DynamoDB Flashcards
NoSQL
Store and retrieve data in a non-tabular format.
Key-value pair database( AWS DynamoDB, Riak, Redis, Aerospike);
Document database(MongoDB, CouchDB, MarkLogic);
graph database(Allefrograph, IBM graph, Neo4J);
Wide column stores((Cassandra, HBase, SimpleDB, Accumulo, Hypertable);
DynamoDB Components
Table(a set of data);
Item;
attributes: basic element of an item, can be further broken down into multiple attributes.
Primary Key
unique identify each item in a table. (Partition key; Partition key and sort key);
where there are many primary keys to few rows.
Secondary Indexes
Global Secondary Index(GSI); a partition key and a sort key which is different from the primary keys defined on the table. no size restrictions; allow to add additional GSIs or delete an existing index. can query the entire table stored across all the partitions in a GSI. You need to configure a separate provisioned throughput for GSI. you need to explicitly specify the read and write capacity units. only support eventually consistency reads. can only query projected attributes.
Local Secondary Index(LSI); uses the same partition key as of the table but uses a different sort key. do not allow add or delete. can query only a single partition with a partition key value specified in the query.
allows 5 GSI and 5 LSI on a table. up to 10GB. does not have their own provisioned throughput. support both consistency reads. can query any attributes.
DynamoDB Streams
capture data modification events. last for 24 hours; can be used along with Amazon Lambda function to create triggers; data replication within or across multiple regions; materialized view; data analysis.
Table can be exported to CSV.DynamoDB Streams usage cannot be tagged.
Data Types
Scalar Types; – number, string, binary, Boolean
Document types;
Set types;
Scalar data types
String – UTF-8; 0-400KB; Partition Key length 2048 bytes; sort key length –1024 bytes
Document Types
List; –
Map;
Provisioned capacity
disabled if auto scaling is enabled.
auto scaling
Target utilization – default 70%;
Minimum provisioned capacity;
maximum provisioned capacity;
need permission – DynamoDBAutoscaleRole
Methods of accessing DynamoDB
DynamoDB console;
….CLI;
API;
Read capacity units
1 read capacity unit = 1 strongly consistent read
1 read capacity unit = 2 eventual consistent reads
1 read operation can process an item of up to 4 KB in size
if an item is more than 4kb in size, requires additional read operations.
if an item is less than 4 KB is size, it still requires 1 read capacity units.
write capacity units
1 write capacity unit = 1 write operation of up to 1 KB in size.
if an item is larger than 1 KB, it requires additional write capacity units.
If an item is less than 1 KB in size, it still requires 1 write capacity unit.
DynamoDB partition
uses SSDs for storing data and automatically replicates data across multiple AZs in an AWS region. Additional partitions will be allocates:
in case a table’s provisioned throughput goes beyond what the existing partitions can handle;
in case an existing partition consumes allocated storage space and more storage space is required.
Read Consistency Model
Eventual Consistent Reads;
Strongly consistent reads;
naming rules
case-sensitive; encoded in UTF-8; 3-255 characters for table and index name; 1 -- 255 for attributes names; special characters: _ - . # and : have special meaning.