DynamoDB Flashcards

1
Q

NoSQL

A

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);

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

DynamoDB Components

A

Table(a set of data);
Item;
attributes: basic element of an item, can be further broken down into multiple attributes.

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

Primary Key

A

unique identify each item in a table. (Partition key; Partition key and sort key);
where there are many primary keys to few rows.

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

Secondary Indexes

A

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.

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

DynamoDB Streams

A

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.

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

Data Types

A

Scalar Types; – number, string, binary, Boolean
Document types;
Set types;

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

Scalar data types

A

String – UTF-8; 0-400KB; Partition Key length 2048 bytes; sort key length –1024 bytes

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

Document Types

A

List; –

Map;

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

Provisioned capacity

A

disabled if auto scaling is enabled.

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

auto scaling

A

Target utilization – default 70%;
Minimum provisioned capacity;
maximum provisioned capacity;
need permission – DynamoDBAutoscaleRole

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

Methods of accessing DynamoDB

A

DynamoDB console;
….CLI;
API;

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

Read capacity units

A

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.

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

write capacity units

A

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.

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

DynamoDB partition

A

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.

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

Read Consistency Model

A

Eventual Consistent Reads;

Strongly consistent reads;

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

naming rules

A
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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Creating table default settings

A

without any secondary indexes and provisions a 5 read with 5 write capacity. Crates a Basic alarms with80% upper threshold using SNS topic “dynamodb”

18
Q

Best Practice

A
  1. Create a primary key that spans across multiple partitions. has more distinct value.
  2. each item can have a maximum 400KB in size. no limit of items in a table. to store large items efficiently: use one to many table, multiple tables, compress large attribute values, store large attribute value in S3. break up large attributes across multiple items.
  3. Query is more economical than scan.
  4. LSI for frequently queried attributes apart from primary key attributes. it improves performance.
  5. If scan is required. design to minimize the impact on read requests on the table.
  6. secondary indexes to perform efficient search.
  7. parallel scan to retrieve a large data set. called as sweepers.
  8. plan LSI carefully as it can only be defined at the time of creating a table and can not be deleted.
19
Q

Global Secondary Index

A

after table created, you can only create GSI, not LSI.

20
Q

Essentials

A

fully managed NoSQL database
can scale up and down depending on demand without downtime or performance degradation.
manage data, not hardware or software.
builtin monitoring
consistent and fast performance
data is stored on fast SSDs.
control performance through read/write capacity
can spread out load across servers and tables
replication across multiple availability zones in an aws region.

21
Q

API-specific limits

A

up to 10 createTable, UpdateTable, DeleteTable actions running simultaneously.
BatchGetItem operation can get a maximum 100 items <16 MB in size.
BatchWriteItem can contain up to 25 PutItem or DeleteItem requests <16 MB
Query and Scan result set is limited to 1MB of data per call.
LastEvaluatedKey in the response can be used to retrieve more.DescribeTable – Returns table size, status, and index information.
ListTables – Returns a list of all tables associated with the current account and endpoint.

22
Q

Read Throughput with local Secondary Indexes

A

use the same read/write capacity from parent table
if read only index and projected attributes, thye calculations are the same, using the size of the index entry,
if queried attributes are not projected attributes or keys. we get extra latency and ready capacity cost..

23
Q

Write THroughput with lSI

A

Write a new item – one write operation to put an item in the index;
change value of an indexed key– two writes are required.
update/delete an item. one write is required.

24
Q

Query

A

only use primary key;
search indexes only;
eventually consistent by default;
use conditional operators and filters to return precise results.
order by sorted key (ascending for both numbers and string by default). To reverse the sort order set the ScanIndexForward parameter to false; Query Get or BatchGetItem API (read multiple items - can get upto 100 items or up to 1MB of data)

25
Q

scan

A

reads every item in the table
looks for all items and attributes in a table by default.
Benefits: –can refine value by applying filters to the results.
–can return only specific attributes with the ProjectionExpression parameter.
Cons: slow performance for larger data set
– the more filters, the slower
– returns only filtered results
only eventually consistent reads are available.
up to 1MB data.
Keep in mind:
– reduce page size with Limit parameter.
– avoid performing scans on mission-critical tables;
– Program your application logic to retry any requests that receives a response code saying that you exceeded provisioned throughput(or increase throughput).
– isolate Scan Operation;

26
Q

Atomic Counters

A

Allow you to increment or decrement the value of an attribute without interfering with other write requests.
not idempotent,(each time will increase the value)

27
Q

Conditional Writes

A

Checks for a condition before proceeding with the operation.
Supported for PutItem, DeleteItem, UpdateItem.
Specify conditions in ConditionExpression.
A failed conditional write returns ConditionalCheckFailedException.

28
Q

Temporary Access

A

IAM roles
Web Identity Federation
Amazon Cognito

29
Q

identity Federation

A

sign in to external systems outside of AWS.

30
Q

Amazon Cognito

A

create unique identities for users;
authenticate identities with identity providers, or your own auth process,
SUpports unauthernticated identities.
save mobile user data.
use credentials obtained to synchronize data with Cognito Sync;

Cognit Sync – Sync user data across mobile devices and web.
client libraries cache data locally.

31
Q

limits of item collection size

A

10GB

32
Q

limits of ProvisionedThroughput

A

(80 K read, 80K write per account for US east, 20K for other regions)

33
Q

DynamoDB support conditional operations

A

Boolean functions: ATTRIBUTE_EXIST, CONTAINS, and BEGINS_WITH
Comparison operators: =, <>, , <=, >=, BETWEEN, and IN
Logical operators: NOT, AND, and OR.

34
Q

DynamoDB vs SimpleDB

A

DynamoDB: no Limits on the request capacity or storage size for a given table;
SImpleDB: strict limit of 10 GB and 25 wrties/second; user manage the partitioning and re-partitioning of your data over additional Simple DB tables; good fit for smaller workloads that require query flexibility. automatically indexes all item attribute4s and thus supports query flexibility.

35
Q

DYnamoDb vs S3

A

SynamoSB: structed data; item 1 - 400 KB. better for smaller data elements or file pointers
S3: unstructred blobs. suited for storing large objects up to 5 TB. for large objects or infrequently accessed data sets.

36
Q

Document SDK

A

The Document SDK is a datatypes wrapper for JavaScript that allows easy interoperability between JS and DynamoDB datatypes. With this SDK, wrapping for requests will be handled for you; similarly for responses, datatypes will be unwrapped.

37
Q

Pricing

A

Provisioned Throughput Capacity
Write throughput 0.0065$ per hour for every 10 units
Read Throughput 0.0065$ per hour for every 50 units
First 25 Go stored per month is free
Storage costs of 0.25$ per month there afterplease note that you are charged by the hour for the throughput capacity, whether or not you are sending requests to your table.

38
Q

Fine Grained Access Control (FGAC)

A

gives a DynamoDB table owner a high degree of control over data in the table

39
Q

Reserved Capacity

A

You cannot cancel your Reserved Capacity and the one-time payment is not refundable
The smallest Reserved Capacity offering is 100 capacity units (reads or writes).
No API to use with Reserved Capacity
Reserved Capacity is associated with a single Region.
Reserved Capacity is applied to the total provisioned capacity within the Region in which you purchased your Reserved Capacity. For example, if you purchased 5,000 write capacity units of Reserved Capacity, then you can apply that to one table with 5,000 write capacity units, or 100 tables with 50 write capacity units, or 1,000 tables with 5 write capacity units, etc.

40
Q

TTL

A

DynamoDB Time-to-Live (TTL) is a mechanism that lets you set a specific timestamp to delete expired items from your table
To specify TTL, first enable the TTL setting on the table and specify the attribute to be used as the TTL value. As you add items to the table, you can specify a TTL attribute if you would like DynamoDB to automatically delete it after its expiration
No you cannot delete an entire table by setting TTL on the whole table
IF the value specified in the TTL attribute for an item is not in the right format, the value is ignored and the item won’t be deleted.
Yes. TTL behaves like any other item attribute. You can create indexes the same as with other item attributes.

41
Q

DynamoDB Time-to-Live (TTL) is a mechanism that lets you set a specific timestamp to delete expired items from your table
To specify TTL, first enable the TTL setting on the table and specify the attribute to be used as the TTL value. As you add items to the table, you can specify a TTL attribute if you would like DynamoDB to automatically delete it after its expiration
No you cannot delete an entire table by setting TTL on the whole table
IF the value specified in the TTL attribute for an item is not in the right format, the value is ignored and the item won’t be deleted.
Yes. TTL behaves like any other item attribute. You can create indexes the same as with other item attributes.

A

a fully managed, highly available, in-memory cache for DynamoDB that enables you to benefit from fast in-memory performance for demanding applications