Easy ReviewDOP-C02
Resilient Cloud Solutions51

DynamoDB

Model keys and choose indexes, capacity, caches, change streams, replication, and recovery.

DynamoDB stores items identified by primary keys. Plan queries and consistency, then choose capacity, expiration, change processing, and recovery.

Indexes and read consistency

DynamoDB stores itemsA collection of named attributes identified by a primary key., or records, in tables. Each item contains attributes, or named values. A primary key identifies an item; a secondary indexSelected table attributes organized under an alternate key for queries. supplies another key for queries. Non-key attributes can vary between items.

How it works

  1. Choose a partition keyThe primary-key attribute that groups items and determines their storage distribution. to group items. A simple primary key uses it alone; a composite primary key adds a sort keyThe second part of a composite primary key that orders items sharing a partition key. that orders items within a group. Each complete key must be unique.
  2. Use Query with one partition-key value and an optional sort-key comparison, BETWEEN range, or begins_with prefix. Results are ascending unless ScanIndexForward=false.
  3. Choose a local secondary index (LSI) for another sort key under the same partition key. Choose a global secondary index (GSI) when different keys and eventual reads fit.
  4. For competing allocation claims, use a conditional writeA write that succeeds only if the current item meets a condition., a write that succeeds only if the current item meets a condition. Reading an allocation alone does not reserve it.

Exam cues

  • If the question says alternate sort key and strong readsA read that returns the latest successful value within the relevant consistency scope. on a new table, think LSI, because it supports strong reads and must exist at table creation.
  • If the question says add an alternate key later, think GSI, because it can be added to an existing table if eventual reads suffice.
  • If the question says a known asset key and date range, think Query, because a key condition narrows reads while Scan reads all items.
  • If the question says only some items need an index entry, think sparse index, because DynamoDB indexes items that have the index key attributes.

Remember

  • Item maximum: 400 KB including attributeA named value stored in an item. names and values.
  • LSI item collection maximum: 10 GB per partition key including table and local index entries.
  • Query page maximum: 1 MB before filtering. Continue with LastEvaluatedKey.
  • GetItem defaults to eventual consistencyA read model in which a recent successful write may not yet appear.. LSIs support strong reads; GSIs do not.
  • A GSI query returns only projected attributes; it cannot fetch others from the table.
  • GSI: partition key plus optional sort key, any schema. Fewer projected attributes cost less to store and write.
  • LSIs are created and deleted with the table.

Trap: A filter does not make Scan cheaper. Reading happens before filtering.

Trap: Adding an LSI to an existing table is unsupported. Create a replacement table and migrate data when that access pattern needs strong reads.

From the AWS docs (18)
  • Query requires partition-key equality and optionally a sort-key comparison, BETWEEN range, or begins_with prefix.
  • Query reads at most 1 MB before filtering; a non-null LastEvaluatedKey means the client must paginate.
  • Query sorts ascending by sort key by default; ScanIndexForward=false reverses order.
  • Scan reads all items in a table or index; its post-read filter does not reduce read capacity consumption.
  • An LSI keeps the table partition key, changes the sort key, is created with the table, and supports eventual or strong reads.
  • A GSI can use different keys, can be added or removed later, and only supports eventual reads.
  • KEYS_ONLY projects table/index keys, INCLUDE adds chosen attributes, and ALL projects all attributes.
  • An LSI query can fetch unprojected attributes from the table at extra latency and read capacity cost.
  • An LSI item collection is limited to 10 GB for one partition key including base table and local index entries.
  • GetItem reads are eventually consistent by default; strong reads return the latest successfully updated value.
  • A conditional write succeeds only if the current item satisfies its condition, protecting against concurrent conflicting updates.
  • A DynamoDB table can have at most five local secondary indexes, and this quota cannot be increased.
  • DynamoDB writes an index entry only when the item has the index key attributes, so a sparse index holds just the items that carry them.
  • GetItem, Query and Scan take an optional ConsistentRead parameter; setting it to true requests a strongly consistent read.
  • A global secondary index query returns only attributes projected into the index; it cannot fetch other attributes from the base table.
  • Every global secondary index has a partition key and an optional sort key, and its key schema can differ from the table's.
  • A global secondary index that projects fewer attributes costs less to store and less to write.
  • Local secondary indexes are created with the table and are deleted when the table is deleted.

Streams and consumer limits

DynamoDB Streams is a log of itemA collection of named attributes identified by a primary key. changes for reacting to inserts, updates, and deletes. A consumerAn application that reads and processes stream records. reads the log. A shardA group of stream records read in sequence by a consumer. is a group of stream records.

How it works

  1. Enable the stream and select the item values to capture. An imageA copy of an item before or after a recorded change. is a copy of an item before or after a change.
  2. DynamoDB records each change once and preserves order for the same item. Readers process parent shards before child shards after a split.
  3. A Lambda event source mapping, the connection that polls the stream and invokes a function, delivers records. Make the handler idempotentSafe to repeat without applying the same business effect again., meaning repeated processing has no additional business effect.
  4. For longer replay or independent readers, consider Kinesis Data Streams for DynamoDB. Enhanced fan-outA Kinesis feature that gives consumers dedicated stream read throughput. provides dedicated consumer read throughput.
StreamViewType Recorded values
KEYS_ONLY Item keys
NEW_IMAGE Item after the change
OLD_IMAGE Item before the change
NEW_AND_OLD_IMAGES Both images

Exam cues

  • If the question says react to each table modification, think Streams and Lambda, because the log captures item changes.
  • If the question says compare old and new values, think NEW_AND_OLD_IMAGES, because keys alone lack those values.
  • If the question says longer replay or independent stream readers, think Kinesis Data Streams for DynamoDB, because its retention and fan-out differ.

Remember

  • Streams retention: 24 hours. Kinesis Data Streams for DynamoDB: up to one year.
  • Changing StreamViewType requires disabling the old stream and creating a new one.

Trap: One record per change in Streams does not guarantee one Lambda execution. Consumer processing can repeat.

From table change to handler
12DynamoDB tableItem change logLambda handler
  1. Table changes create stream records with the selected images.

  2. An event source mapping reads records and invokes Lambda; processing can repeat.

From the AWS docs (6)
  • DynamoDB Streams records item modifications in near real time for 24 hours.
  • A stream contains each change once and orders changes per item; readers process parent shards before child shards.
  • StreamViewType accepts KEYS_ONLY, NEW_IMAGE, OLD_IMAGE, and NEW_AND_OLD_IMAGES for keys, after image, before image, or both.
  • Changing StreamViewType requires disabling the current stream and creating another stream.
  • Lambda event source mappings process events at least once and can repeat records; handlers should be idempotent.
  • Kinesis Data Streams for DynamoDB is a separate change-capture option with retention up to one year and enhanced fan-out.

Backups and point-in-time recovery

DynamoDB backups preserve earlier table data for recovery from unwanted writes or deletions. Point-in-time recoveryContinuous backups that allow restoration to a chosen second within a retained window. (PITR) keeps continuous recovery points. On-demand backups preserve full table backups for longer retention.

How it works

  1. Enable PITR before an incident and choose the recovery period. Create on-demand backups for long-term retention.
  2. After unwanted writes, choose a recovery point before the damage. Global table replication also copies those writes.
  3. Restore into a new table, in the source Region or another Region. A restored global table replicaA regional table participating in global table replication. is independent of the original global table.
  4. For analysis in S3, export a point within the PITR window. To load data from S3, import into a new DynamoDB table.
Option Purpose Capacity or retention
PITR Restore an earlier second 1 to 35 days, default 35
On-demand backup Long-term full backup Retained until deleted
Export to S3 Send a PITR point to S3 No table read capacity
Import from S3 Load a new table No table write capacity

Exam cues

  • If the question says recover before an accidental overwrite, think PITR into a new table, because replication does not preserve the earlier state.
  • If the question says retain a backup beyond 35 days, think on-demand backup, because PITR has a bounded window.
  • If the question says analyze data without table read capacity, think PITR-backed S3 export, because export does not consume RCUs, the table’s read capacity unitsProvisioned capacity for one strong or two eventual reads per second of items up to 4 KB..
  • If the question says load S3 data without write capacity, think import into a new table, because existing-table import is unsupported.

Remember

  • PITR window: 1 to 35 days, default 35, with one-second recovery points.
  • The latest restorable point is about five minutes behind the current time.
  • Disabling and re-enabling PITR resets its recovery window.
  • Export: DynamoDB JSON or Amazon Ion. Import also accepts CSV.
  • S3 import supports GSIs, or global secondary indexesSelected table attributes organized under an alternate key for queries., but not LSIs, or local secondary indexes.

Trap: Restore creates another table. It does not undo writes in place or automatically rejoin a restored replica to its global table.

PITR restores another table
12Source tableRecovery pointsNew table
  1. PITR continuously backs up data while enabled.

  2. Choose an earlier point and restore it into a new table.

From the AWS docs (14)
  • PITR keeps per-second continuous recovery points for 1 to 35 days; the default is 35 days.
  • PITR restores an earlier table state into a new table rather than rolling back the source in place.
  • The PITR restore window ends about five minutes before the current time.
  • Disabling and re-enabling PITR resets the start of the recovery window.
  • PITR is enabled per global table replica, and a restore creates an independent table; cross-Region restores are supported.
  • Global tables replicate application writes, including unwanted modifications, to other replicas.
  • On-demand backups are full table backups for long-term retention and do not affect table performance or availability.
  • On-demand DynamoDB backups are retained until explicitly deleted.
  • S3 export requires PITR, selects a point within its window, and consumes no table read capacity.
  • S3 export supports DynamoDB JSON and Amazon Ion formats.
  • S3 import creates a new table without consuming write capacity and does not support import into existing tables.
  • S3 import accepts CSV, DynamoDB JSON, and Amazon Ion, and supports creating GSIs but not LSIs.
  • DynamoDB deletion protection, off by default, stops a table from being deleted until an authorized administrator turns the property off.
  • Point-in-time recovery is off by default and must be enabled for each table before it can be restored to a point in time.

Global tables

DynamoDB global tables replicate data across Regions so applications can read and write through regional replicasA regional table participating in global table replication.. A replica is a regional table participating in that replication.

How it works

  1. Choose the consistency mode at creation; it is fixed across the global table.
  2. Multi-Region eventual consistencyA read model in which a recent successful write may not yet appear. (MREC) accepts a local write and copies it asynchronously. Simultaneous changes to an itemA collection of named attributes identified by a primary key. resolve to the version with the latest internal timestamp.
  3. Multi-Region strong consistency (MRSC) copies a write synchronously to another Region before success. Strong readsA read that returns the latest successful value within the relevant consistency scope. at any replica return the latest item.
  4. If application processing is impaired in a Region, shift traffic to another replica that can serve reads and writes.
Property MREC MRSC
Replication Asynchronous Synchronous before success
Strong read May miss remote writes in transit Latest item across replicas

Exam cues

  • If the question says regional writes with eventual convergence, think MREC, because replication is asynchronous.
  • If the question says strong reads must include remote writes, think MRSC, because write success requires synchronous replication.

Remember

  • Default: MREC. The mode cannot change or differ between replicas.
  • MRSC conversion needs an empty table; additional replicas cannot be added afterward.
  • MRSC supports same-account configurations only. MREC also supports multi-account configurations.
  • Current version (2019.11.21): create an MREC global table by adding a replica to an existing table.
  • MREC replication: typically a second or less; RPO equals that delay, usually a few seconds.

Trap: Strong reads on an MREC replica do not make cross-Region replication synchronous. A remote write can still be missing.

MREC replication between Regions
1Replica Region AReplica Region B
  1. A write accepted in Region A replicates asynchronously to Region B; both replicas accept application writes.

From the AWS docs (11)
  • Global tables provide managed replication across Regions and every replica can serve reads and writes.
  • MREC is the default mode; consistency mode cannot change after creation or differ between replicas.
  • MREC replicates asynchronously and resolves concurrent item updates by latest internal timestamp, called last writer wins.
  • Strong reads on MREC can miss recent writes in another Region that have not replicated locally.
  • MRSC synchronously replicates a write to at least one other Region before success; strong reads at any replica return the latest item.
  • Conversion to MRSC requires an empty table and additional replicas cannot be added later.
  • Global tables support same-account and multi-account configurations; MRSC supports same-account configurations only.
  • Applications can shift traffic to another global table replica if application processing is interrupted in a Region.
  • The AWS Database Encryption SDK encrypts chosen DynamoDB attributes on the client before they are sent, so the table holds only ciphertext for those fields.
  • In the current global tables version (2019.11.21), which AWS recommends over the legacy 2017.11.29 version, an MREC global table is created by adding a replica to an existing DynamoDB table.
  • MREC replicates item changes to the other replicas asynchronously, typically within a second or less; its RPO equals the replication delay, usually a few seconds depending on the Regions.

Capacity scaling and throttling

DynamoDB capacity controls how much read and write work a table can accept. On-demand bills for requests and scales automatically. Provisioned capacity sets read and write units available each second.

How it works

  1. Choose on-demand to avoid provisioning capacity units. Quotas and any configured maximum throughput still apply.
  2. With provisioned capacity, calculate read capacity unitsProvisioned capacity for one strong or two eventual reads per second of items up to 4 KB. (RCUs) and write capacity unitsProvisioned capacity for one standard write per second of an item up to 1 KB. (WCUs) from itemA collection of named attributes identified by a primary key. size and operation type. Round size before applying multipliers.
  3. Configure Application Auto Scaling for the table and global secondary indexesSelected table attributes organized under an alternate key for queries. (GSIs), which have separate capacity. Set minimum, maximum, and target utilizationThe desired percentage of provisioned capacity consumed by a workload., the desired consumed share of provisioned capacity.
  4. DynamoDB sends capacity measurements to CloudWatch. An alarm invokes Application Auto Scaling to issue UpdateTable. Capacity changes take time.
  5. Diagnose throttlingRejection of requests when work exceeds an applicable throughput limit., rejected work beyond a throughput limit, with exception reasons and metrics. GSI back-pressureThrottling of table writes because an index cannot accept their updates fast enough. means an index cannot keep up and table writes throttle too.
Item operation Size rounding Units per block
Strong readA read that returns the latest successful value within the relevant consistency scope. 4 KB 1
Eventual read 4 KB 0.5
Transactional read 4 KB 2
Standard write 1 KB 1
Transactional write 1 KB 2

Exam cues

  • If the question says avoid provisioning units, think on-demand, because capacity scales with requests.
  • If the question says table writes fail because of an index, think GSI write capacity, because index back-pressure can throttle base writes.
  • If the question says distinguish write bottlenecks from reads, think WriteThrottleEvents, because it counts write throttles.

Remember

  • Auto scaling utilization target: 20 to 90 percent, within capacity bounds.
  • Scale-out triggers after two consecutive minutes above target, followed by alarm and update delay.
  • An 8 KB item read uses 2 strong, 1 eventual, or 4 transactional read units.
  • Index metrics use TableName and GlobalSecondaryIndexName.
  • Query sums returned item sizes, then rounds up to 4 KB. Scan counts every item evaluated, filtered or not.

Trap: Auto scaling does not react instantly to spikes. On-demand can also throttle at quotas or configured maximums.

Provisioned capacity control loop
12DynamoDB tableCloudWatchAuto Scaling
  1. DynamoDB publishes consumed capacity; CloudWatch evaluates the target alarm.

  2. The alarm invokes Application Auto Scaling, which issues UpdateTable to adjust capacity.

From the AWS docs (21)
  • On-demand capacity bills per request and scales without provisioning read or write units.
  • On-demand requests can throttle at quotas or configured maximum throughput.
  • Provisioned mode sets capacity units; Application Auto Scaling adjusts table and GSI capacity within minimum/maximum bounds toward target utilization.
  • Auto scaling target utilization can be from 20 to 90 percent.
  • Scale-out triggers after two consecutive minutes above target; alarms and UpdateTable processing add delay during which excess requests can throttle.
  • DynamoDB publishes consumed capacity to CloudWatch; an alarm invokes Application Auto Scaling, which issues UpdateTable.
  • Item reads round up to 4 KB blocks; a strong read uses 1 unit per block, an eventual read 0.5, and a transactional read 2.
  • Item writes round up to 1 KB blocks; standard writes use 1 unit per block and transactional writes use 2.
  • Insufficient GSI write capacity can throttle base table writes through back-pressure, identified by IndexWriteProvisionedThroughputExceeded.
  • WriteThrottleEvents counts throttled write events; ReadThrottleEvents distinguishes read throttles, and index metrics use TableName with GlobalSecondaryIndexName.
  • Standard is the default table class; Standard-IA targets infrequently accessed tables where storage dominates costs.
  • An 8 KB item read uses 2 strong, 1 eventual, or 4 transactional read units.
  • DynamoDB automatically replicates table data across three Availability Zones in a Region.
  • DynamoDB reserved capacity discounts provisioned read and write capacity for a one-year term (three years in some Regions); it is not available for on-demand mode.
  • Other than the primary key, a DynamoDB table is schemaless: items can have different attributes and data types.
  • DynamoDB uses provisioned throughput best when the workload is spread across many distinct partition key values; a key with few values, such as a creation date, concentrates traffic on a few partitions.
  • On-demand is the default and recommended throughput mode for most DynamoDB workloads.
  • A table can switch from provisioned to on-demand up to four times in a rolling 24-hour window; switching from on-demand to provisioned is allowed at any time.
  • DynamoDB retains up to five minutes (300 seconds) of unused read and write capacity that short bursts can consume.
  • DynamoDB encrypts all table data at rest; the default AWS owned key has no extra charge, while AWS managed and customer managed keys incur KMS charges.
  • A Query sums the size of all items it returns and rounds the total up to the next 4 KB; a Scan counts the size of every item it evaluates, not only the items it returns.

DAX read caching

DynamoDB Accelerator (DAX) caches frequently read DynamoDB data in memory. A cache is a temporary data copy. DAX helps repeated reads when the application tolerates eventual consistencyA read model in which a recent successful write may not yet appear., meaning recent writes may not yet appear.

How it works

  1. Connect through the DAX client to a cluster within a VPCA private virtual network where security groups can control DAX cluster access., a private virtual network. Security groups control cluster access.
  2. For an eventual read, check the cache. A hit returns cached data; a miss reads DynamoDB and caches the result.
  3. Store individual reads in the itemA collection of named attributes identified by a primary key. cache and Query or Scan results in the separate query cache.
  4. Standard writes through DAX reach DynamoDB first, then update the item cache before success. Direct table writes bypass this cache update.
  5. Forward strong readsA read that returns the latest successful value within the relevant consistency scope., which require the latest successful value, and transactional TransactGetItems reads to DynamoDB without caching their results.
Read Behavior
Eventual GetItem or BatchGetItem Item cache by primary key
Eventual Query or Scan Separate query-result cache
Strong read or TransactGetItems Forwarded without caching

Exam cues

  • If the question says repeated eventual reads need microsecond latency, think DAX, because cache hitsA request served from a valid cached copy without reading the underlying table. avoid table reads.
  • If the question says a direct table write leaves an item stale in DAX, think item-cache bypass, because direct writes do not update that cache.
  • If the question says every read requires the latest value, think strong DynamoDB reads, because DAX forwards those requests.

Remember

  • A production cluster needs at least three nodes in different Availability Zones for fault tolerance.
  • A cluster has one primary and up to 10 read replicasA regional table participating in global table replication.; a replica is promoted if the primary fails.

Trap: DAX does not serve strongly consistent reads from its cache. It forwards them to DynamoDB.

An eventual read through DAX
12DAX clientDAX cacheDynamoDB table
  1. The client asks DAX for an item; a cache hit can return it directly.

  2. On a miss, DAX reads DynamoDB and caches the result.

From the AWS docs (11)
  • DAX is an in-memory cache for repeated eventually consistent DynamoDB reads with microsecond response times.
  • The item cache stores GetItem and BatchGetItem results by primary key with a default TTL of five minutes.
  • The query cache stores Query and Scan result sets separately from the item cache.
  • Item or table writes do not invalidate cached query results; new query results are read after the cached result TTL expires.
  • Standard writes through DAX reach DynamoDB before updating its item cache and returning success; direct table writes do not update that cache.
  • DAX forwards strong reads and TransactGetItems to DynamoDB without caching their results.
  • DAX runs in a VPC and security groups control cluster access.
  • DynamoDB table TTL expires stored items for background deletion, rather than expiring cached copies.
  • DAX is not a fit for applications that need strongly consistent reads or that are write-intensive.
  • A DAX cluster has one primary node and up to 10 read replicas; if the primary fails, DAX promotes a read replica.
  • AWS recommends at least three DAX nodes in different Availability Zones for production; three nodes are required for a fault-tolerant cluster.

Operational diagnosis and cache behavior

DynamoDB operations can involve table and index capacity, cached reads, and index projectionsThe attributes copied from a table into an index.. Understanding which resource or cache holds the data helps explain throttlingRejection of requests when work exceeds an applicable throughput limit., stale results, and extra reads.

How it works

  1. Compare WriteThrottleEvents and ReadThrottleEvents to distinguish write and read throttling. For index metrics, use both TableName and GlobalSecondaryIndexName. An IndexWriteProvisionedThroughputExceeded reason can point to GSI write back-pressureThrottling of table writes because an index cannot accept their updates fast enough. throttling base table writes.
  2. Check the capacity mode switch limit before switching from provisioned to on-demand. The reverse switch is allowed at any time.
  3. DAX keeps GetItem and BatchGetItem results by primary key in an itemA collection of named attributes identified by a primary key. cache. It stores Query and Scan result sets in a separate query cache. A cache time to live (TTL) sets how long a result remains cached. Writes do not invalidate cached query results; they are read again after the query-cache TTL expires.
  4. A local secondary indexSelected table attributes organized under an alternate key for queries. (LSI) keeps the table partition keyThe primary-key attribute that groups items and determines their storage distribution. and uses another sort keyThe second part of a composite primary key that orders items sharing a partition key.. Choose its projection, the attributes copied into the index: KEYS_ONLY copies table and index keys, INCLUDE adds selected attributes, and ALL copies all attributes. An LSI query can fetch unprojected attributes from the table, with extra latency and read capacity cost.

Exam cues

  • If the question says a write consumerAn application that reads and processes stream records. is falling behind, think WriteThrottleEvents, because it counts write throttles separately from read throttles.
  • If the question says table writes throttle due to a GSI, think index write capacity, because back-pressure can affect base table writes.
  • If the question says a query stays stale after an item update, think query-cache TTL, because writes do not invalidate cached query results.
  • If the question says an LSI repeatedly fetches attributes from the table, think INCLUDE or ALL, because projecting those attributes can avoid the fetches.

Remember

  • A table can switch from provisioned to on-demand up to four times in a rolling 24-hour window; on-demand to provisioned is allowed at any time.
  • DAX item-cache default TTL: five minutes.
  • A table can have at most five LSIs, a fixed quota. LSIs must be created with the table.
  • MRSC needs exactly three Regions: three replicasA regional table participating in global table replication., or two replicas plus a witnessAn MRSC component in a third Region that supports availability without serving application reads or writes. that serves no application reads or writes.
  • MRSC does not support TTL, local secondary indexes or transactions.
  • MREC replication reads DynamoDB Streams, which stay enabled on every replica.
  • DynamoDB Streams: plan at most two simultaneous readers per shardA group of stream records read in sequence by a consumer.; the Kinesis Adapter changes the client interface, not those limits.

Trap: Updating an item does not refresh a cached DAX Query or Scan result. The query cache is separate from the item cache.

From the AWS docs (17)
  • WriteThrottleEvents counts throttled write events; ReadThrottleEvents distinguishes read throttles, and index metrics use TableName with GlobalSecondaryIndexName.
  • Insufficient GSI write capacity can throttle base table writes through back-pressure, identified by IndexWriteProvisionedThroughputExceeded.
  • A table can switch from provisioned to on-demand up to four times in a rolling 24-hour window; switching from on-demand to provisioned is allowed at any time.
  • The query cache stores Query and Scan result sets separately from the item cache.
  • Item or table writes do not invalidate cached query results; new query results are read after the cached result TTL expires.
  • The item cache stores GetItem and BatchGetItem results by primary key with a default TTL of five minutes.
  • KEYS_ONLY projects table/index keys, INCLUDE adds chosen attributes, and ALL projects all attributes.
  • An LSI query can fetch unprojected attributes from the table at extra latency and read capacity cost.
  • A DynamoDB table can have at most five local secondary indexes, and this quota cannot be increased.
  • An LSI keeps the table partition key, changes the sort key, is created with the table, and supports eventual or strong reads.
  • MRSC needs exactly three Regions, using three replicas or two replicas and a witness that cannot serve application reads or writes.
  • MRSC does not support TTL, LSIs, or DynamoDB transaction operations.
  • MREC replication reads changes from DynamoDB Streams, which are enabled by default on every replica and cannot be disabled there.
  • DynamoDB Streams supports up to two simultaneous readers per shard; exceeding this can throttle reads.
  • The DynamoDB Streams Kinesis Adapter lets Kinesis Client Library applications read DynamoDB Streams without changing the underlying service.
  • Kinesis Data Streams for DynamoDB is a separate change-capture option with retention up to one year and enhanced fan-out.
  • AWS recommends at most two simultaneous Lambda functions per shard for single-Region tables and one for global tables.

Flashcards

tap to flip
Answer

·

All 51 cards as a list

How do DynamoDB LSI and GSI keys, creation, and consistency differ?

An LSI keeps the table partition key, changes the sort key, must exist at table creation, and supports strong reads. A GSI can change both keys, be added later, and only supports eventual reads.

A new DynamoDB table needs an alternate sort key with strongly consistent reads. Which index fits?

An LSI, defined at table creation, with the same partition key.

An existing DynamoDB table needs strong reads through a new alternate sort key. Can the team add an LSI?

No. Create a replacement table with the LSI and migrate the data. An LSI cannot be added later.

A DynamoDB application knows an asset partition key and needs revisions within a date range. Which request fits?

Query with partition-key equality and BETWEEN on the date sort key. Use begins_with for a sort-key prefix.

A filtered DynamoDB Scan returns few items but consumes high read capacity. Why?

The filter runs after reading. Use a suitable table or index key for Query when the access pattern permits it.

A DynamoDB application needs to query the same items using a different partition key. Which index fits?

Use a global secondary index. It can use different keys, but its reads are eventually consistent.

Only orders with an open status should be queryable cheaply in a large DynamoDB table. How can an index hold just those items?

A sparse index: set the index key attribute (such as OpenFlag) only on open orders. DynamoDB writes index entries only for items that have the index key attributes.

An Amazon DynamoDB query on a global secondary index needs an attribute that is not projected into the index. Can the query fetch it from the base table?

No. A GSI query returns only projected attributes.

Project the attribute into the index, or read the item from the table.

A team wants to remove an Amazon DynamoDB local secondary index but keep the table. Is that possible?

No. An LSI is created with the table and is deleted only with the table.

A global secondary index can be added or removed later.

An Amazon DynamoDB global secondary index serves a query that needs only three attributes. Why project only those attributes?

A smaller index costs less to store and less to write.

The query still gets every attribute it needs from the index.

How can an application react to DynamoDB item changes, and how long are records kept?

Enable DynamoDB Streams and connect Lambda. Retention is 24 hours. For replay up to one year, choose Kinesis Data Streams for DynamoDB. Make processing safe to repeat.

A DynamoDB consumer must compare an item before and after each change. Which setting fits?

NEW_AND_OLD_IMAGES. KEYS_ONLY does not include item values.

Does one change record in DynamoDB Streams mean Lambda processes it exactly once?

No. Lambda can process a record again. Use an idempotent handler so repeating it does not repeat its business effect.

A bad deployment overwrote DynamoDB items. How should a team recover if PITR was enabled?

Restore a point before the bad writes into a new table. PITR keeps 1 to 35 days, default 35, with per-second recovery points. Cross-Region restore is supported.

Does a DynamoDB global table protect from application writes that corrupt data?

No. Those writes replicate. Restore an earlier PITR point or backup into a new table. A restored replica is independent of the original global table.

A team needs DynamoDB backup retention beyond the PITR window. Which option fits?

On-demand full table backups, retained until explicitly deleted.

A DynamoDB table has an accidental overwrite that also reaches its global table replicas. How can the team recover an earlier state?

Restore a point before the overwrite with point-in-time recovery into a new table.

A team needs a DynamoDB backup retained beyond the point-in-time recovery window. What should it use?

Use an on-demand backup. It is retained until explicitly deleted.

Does re-enabling DynamoDB PITR bring back its old recovery window?

No. Disabling and re-enabling PITR resets the beginning of that window.

A DynamoDB table was created with default settings. Can it be restored to its state from two hours ago?

No. PITR is off by default; enable it first, then restores are possible within its retention window.

How do DynamoDB global tables MREC and MRSC differ?

MREC is the default, using asynchronous replication and last-writer-wins conflicts. MRSC replicates synchronously before write success and supports strong reads across replicas. Mode is fixed and cannot be mixed.

A DynamoDB application must keep serving reads and writes after a Region becomes impaired. What fits?

Global tables, with application traffic shifted to a healthy regional replica. Every replica can accept reads and writes.

A DynamoDB MREC replica uses strong reads immediately after a remote write. Must the read include that write?

No. A strong read does not remove MREC replication delay. MRSC provides strong reads across replicas.

A DynamoDB global table must provide the latest item on strong reads in each replica Region. Which consistency mode fits?

Use multi-Region strong consistency (MRSC). It replicates a write to at least one other Region before reporting success.

A team wants an existing single-Region Amazon DynamoDB table to replicate to a second Region with the current global tables version. How does it create the global table?

Add a replica in the second Region to the existing table.

Creating separate tables first and linking them belongs to the legacy 2017 version.

How quickly does an Amazon DynamoDB MREC global table usually copy a write to the other Regions, and what does that mean for RPO?

Typically within a second or less.

The RPO equals that replication delay, usually a few seconds.

How should a team choose and scale DynamoDB on-demand or provisioned capacity?

On-demand avoids provisioning units. Provisioned sets read/write capacity and can use Application Auto Scaling within minimum and maximum bounds. Scaling has delay, so spikes can still throttle.

DynamoDB base table writes fail with IndexWriteProvisionedThroughputExceeded. What should the team inspect?

GSI write capacity and scaling limits. Index write back-pressure can throttle the base table.

How many read units does a DynamoDB 8 KB item read use for strong, eventual, and transactional reads?

2 strong, 1 eventual, or 4 transactional. Round size in 4 KB blocks, then apply the consistency multiplier.

How does DynamoDB calculate standard and transactional item write units?

Round item size up to 1 KB blocks. A standard write uses 1 unit per block; a transactional write uses 2.

Does DynamoDB on-demand guarantee that requests can never throttle?

No. Quotas and any configured maximum throughput still apply.

A DynamoDB table throttles writes while most of its provisioned capacity sits unused. What partition key change helps?

Choose a high-cardinality partition key, one with many distinct values, so requests spread evenly across partitions.

A provisioned DynamoDB table briefly exceeds its write capacity for a few seconds without throttling. Which feature explains it?

Burst capacity: DynamoDB keeps up to 300 seconds of unused capacity for short bursts. It is not guaranteed, because background work can use it.

A DynamoDB workload has unpredictable request traffic and the team does not want to provision capacity units. Which capacity mode fits?

Use on-demand capacity. It scales without provisioning read or write units and bills per request.

An Amazon DynamoDB Scan with a filter evaluates 100 KB of items but returns only 10 KB. Which size determines its read capacity?

The 100 KB evaluated.

Scan charges for items evaluated, so a filter does not reduce read capacity.

An Amazon DynamoDB Query returns ten 1 KB items with strongly consistent reads. How many read capacity units does it consume?

3. Query sums the items (10 KB) and rounds up to 12 KB, three 4 KB units.

A DynamoDB application requires every read to be strongly consistent. Will DAX serve those reads from memory?

No. DAX forwards strong reads and TransactGetItems to DynamoDB without caching results.

An application writes directly to DynamoDB while reading through DAX. Why can a cached item remain stale?

Direct writes bypass the item-cache update. Standard writes through DAX update that cache after DynamoDB succeeds.

An app on DynamoDB needs a cache of computed leaderboard aggregates, not of individual items or queries. DAX or ElastiCache?

ElastiCache. DAX caches DynamoDB item and query results; computed values from application logic belong in a general-purpose cache.

How should a production DAX cluster be sized for fault tolerance?

At least three nodes in different AZs. A cluster has one primary and up to 10 read replicas, and DAX promotes a replica if the primary fails.

A DynamoDB write consumer is falling behind. Which metric distinguishes write throttling from read throttling?

WriteThrottleEvents. Compare ReadThrottleEvents and inspect table/index dimensions and exception reasons to locate the affected resource.

A team switched a DynamoDB table from provisioned to on-demand and back several times today; the next switch to on-demand is rejected. Why?

Provisioned-to-on-demand switches are limited to four per rolling 24 hours. Switching from on-demand to provisioned has no such limit.

An application updates a DynamoDB item through DAX but an identical Query still returns an old result. Why?

The query cache is separate. Item writes do not invalidate Query or Scan results; the cached query must expire.

What keys and default expiration does the DAX item cache use?

Primary keys for GetItem and BatchGetItem results, with a five-minute default item-cache TTL.

A DynamoDB LSI query repeatedly fetches extra attributes from the table. How can the team reduce those reads?

Project required attributes with INCLUDE or ALL. This trades index storage for fewer base table fetches.

How many local secondary indexes can a DynamoDB table have?

Five, a fixed quota. LSIs are also created only with the table.

A DynamoDB MRSC design needs only two full replicas. What else is required?

A witness in a third Region. MRSC needs exactly three Regions; the witness cannot serve application reads or writes.

Can a DynamoDB MRSC table use TTL, local secondary indexes, and transactions?

No. MRSC does not support those features.

A team wants to disable DynamoDB Streams on an MREC global table replica. Is that supported?

No. MREC replication reads changes from DynamoDB Streams, which are enabled by default and cannot be disabled on its replicas.

Several DynamoDB Streams consumers throttle on one shard. Does the Kinesis Adapter remove that limit?

No. It still reads DynamoDB Streams. Reduce direct readers, distribute records downstream, or choose Kinesis Data Streams with enhanced fan-out.

How many simultaneous Lambda readers should a team plan per DynamoDB Streams shard?

Up to two functions for a single-Region table; AWS recommends one for a global table to avoid throttling.

You finished every topic of DOP-C02!

Your badge turned gold. Next step: book the exam on AWS. Once you pass, add yourself to Who passed.

Share

Share that you finished this certification

I finished every topic of AWS Certified DevOps Engineer - Professional (DOP-C02) on Easy Review. Come study too!