Study guide
Technical reference and lesson notes
Purpose of This Lesson
This lesson explains Amazon DynamoDB as a fully managed, serverless NoSQL database. The key assessment skill is recognizing which DynamoDB feature, API, consistency model, table class, or access-control mechanism fits a stated operational requirement.
Key Concepts
- DynamoDB is an AWS-created, fully managed NoSQL database service that supports key-value and document data models.
- Serverless and horizontally scalable: DynamoDB distributes tables across partitions and replicates data across multiple Availability Zones in an AWS Region. Scaling is horizontal rather than vertical and can occur without downtime.
- Low latency: Standard DynamoDB operations provide latency in milliseconds. DynamoDB Accelerator (DAX) is an in-memory caching layer that can reduce read latency to microseconds.
- Global Tables: Tables can be replicated across Regions using asynchronous replication. Global Tables support multi-Region, multi-master writes, allowing updates in different Regions.
- Flexible schema: Items in the same table can contain different attributes, making DynamoDB useful when data is irregular or unpredictable.
- DynamoDB Streams: Item-level changes—such as inserts, updates, and deletes—produce stream records that other services, including Lambda, can process.
- Consistency and transactions: DynamoDB supports eventually consistent and strongly consistent reads, as well as ACID transactions.
- Recovery: Point-in-time recovery supports restoring to a second within the preceding 35 days. On-demand backup and restore are also available.
DynamoDB Architecture and Data Model
DynamoDB organizes data as follows:
- Table: The primary container for data.
- Item: An individual entry in a table, comparable to a row in a relational database.
- Attribute: A named value associated with an item, comparable in some ways to a column value, although DynamoDB items can have a flexible set of attributes.
- Primary key: The key used to identify and retrieve items. The lecture emphasizes a key-value structure in which the key identifies an item and its attributes provide the associated values.
Tables are distributed across partitions and replicated across multiple Availability Zones within a Region. This architecture provides fault tolerance, high availability, and horizontal scaling while using solid-state-drive storage.
DynamoDB also supports indexes and streams. These are sub-resources associated with a table and have their own Amazon Resource Names (ARNs), which matters when writing resource-based permissions.
Performance, Consistency, and Availability
Latency and DAX
DynamoDB normally provides millisecond-level latency. If a requirement specifically calls for microsecond-level read latency, consider DAX. DAX caches DynamoDB data in memory and reduces the need to retrieve frequently accessed data directly from the database.
DAX is a caching layer, not a replacement for the underlying DynamoDB table. The decisive clue is the latency requirement: milliseconds generally point to DynamoDB itself, while microseconds point toward DynamoDB with DAX.
Read Consistency
DynamoDB supports:
- Eventually consistent reads: The read may not immediately reflect the latest write, but this model is suitable when the application can tolerate a short replication delay.
- Strongly consistent reads: The read reflects the latest successful write, when the application requires current data.
The choice depends on application correctness requirements rather than simply selecting the strongest option by default.
Global Tables
Global Tables provide a fully managed, multi-Region, multi-master configuration. Applications can write to tables in different Regions, and changes are replicated asynchronously between Regions. This supports geographically distributed applications, but asynchronous replication means updates are not instantaneous across Regions.
The lecture identifies a four-nines availability SLA for DynamoDB and a five-nines availability SLA for Global Tables. Treat these figures as the lesson’s stated service characteristics and focus on recognizing the architectural distinction between regional tables and multi-Region Global Tables.
DynamoDB APIs and Operations
DynamoDB APIs are divided into control-plane and data-plane operations.
Control Plane
Control-plane operations manage the table or inspect its configuration. Examples include:
- Creating a table
- Describing a table
- Listing tables
- Updating a table
- Deleting a table
Data Plane
Data-plane operations work with items and implement create, read, update, and delete behavior. They can be performed through standard DynamoDB CRUD APIs or PartiQL.
| Operation | Purpose |
|---|---|
PutItem | Writes one item to a table. |
BatchWriteItem | Writes up to 25 items, making multiple writes more efficient. |
GetItem | Retrieves one item. |
BatchGetItem | Retrieves up to 100 items from one or more tables. |
UpdateItem | Modifies one or more attributes in an item. |
DeleteItem | Deletes an item. |
A common assessment distinction is whether the operation manages the table itself or manipulates table data. Creating or deleting a table is control plane; putting, getting, updating, or deleting items is data plane.
Data Types and Table Classes
DynamoDB data types fall into three broad categories:
- Scalar types: Numbers, strings, binary values, Boolean values, and null.
- Document types: Structured document values such as JSON documents.
- Set types: Collections of scalar values, such as string sets, number sets, and binary sets.
DynamoDB table classes include:
- Standard: The default and recommended class for most workloads.
- Standard-Infrequent Access: A lower-cost storage option for tables whose data is accessed infrequently, such as application logs, older social media posts, historical e-commerce orders, or past gaming achievements.
The table-class decision is driven by access frequency. Standard-Infrequent Access is appropriate when data is retained but accessed less often; Standard is the general-purpose default.
DynamoDB Streams and Event-Driven Processing
DynamoDB Streams captures records of item changes, including additions, modifications, and deletions. Other services can consume these records. For example, AWS Lambda can process a stream record when an item is deleted and store an external record of that deletion.
Use Streams when downstream processing must react to table changes without requiring the application to implement a separate notification mechanism. The stream is particularly useful for event-driven workflows, audit-style processing, and synchronizing changes with another system, within the capabilities of the consuming workflow.
Backup and Recovery
DynamoDB provides two backup approaches described in the lesson:
- Point-in-time recovery (PITR): Restore a table to a specific second within the previous 35 days.
- On-demand backup and restore: Create backups and restore them when needed without relying on a specific point-in-time recovery window.
Choose PITR when the requirement is recovery to a precise recent time. Choose on-demand backup when explicitly creating and retaining backup points is the stated operational need.
Access Control with IAM
DynamoDB authentication and access control use AWS Identity and Access Management (IAM). Two policy approaches are relevant:
Identity-Based Policies
Identity-based policies attach to IAM users, groups, or roles and grant permissions to perform DynamoDB actions. A role can be used to grant permissions for cross-account access when the required trust and permissions configuration is in place.
Resource-Based Policies
Resource-based policies attach directly to DynamoDB resources, including tables, indexes, and streams. They can specify which principals may perform actions on those resources. The lecture states that a resource-based policy attached to a DynamoDB resource can be up to 20 KB.
DynamoDB resources have unique ARNs. A policy can therefore target a specific table, index, or stream rather than granting access through an unrestricted wildcard.
For example, dynamodb:ListTables is a control-plane action. A policy allowing it may use a broad resource scope because the example in the lesson specifies Resource: *. By contrast, actions such as DeleteTable, Query, and Scan can be restricted to a named table such as books.
Exam- or Assessment-Relevant Takeaways
- Select DAX when the scenario explicitly requires microsecond read latency; ordinary DynamoDB is associated with millisecond latency.
- Select Global Tables for a fully managed multi-Region, multi-master database that permits writes in multiple Regions.
- Remember that Global Tables replicate changes asynchronously between Regions.
- Distinguish control-plane table-management APIs from data-plane item operations.
- Use
BatchWriteItemfor up to 25 item writes andBatchGetItemfor up to 100 item reads from one or more tables. - Identify DynamoDB Streams when another service, such as Lambda, must react to item-level changes.
- Choose strongly consistent reads when the application requires the latest successful write; choose eventually consistent reads when a short delay is acceptable.
- Use PITR when restoration to a precise second within the previous 35 days is required.
- Use Standard-Infrequent Access for retained data that is accessed less frequently than typical general-purpose workloads.
- Use IAM identity-based policies for permissions attached to users, groups, or roles, and resource-based policies when permissions should be defined on tables, indexes, or streams.
Tool / Feature Decision Guide
| Requirement | DynamoDB feature or choice | Reason |
|---|---|---|
| Fully managed, flexible NoSQL storage | DynamoDB | Supports key-value and document data with serverless operation. |
| Millisecond-level database latency | Standard DynamoDB | This is the normal DynamoDB performance profile described in the lesson. |
| Microsecond-level latency | DAX in front of DynamoDB | DAX provides an in-memory cache to reduce latency. |
| Multi-Region writes | Global Tables | Provides a managed multi-Region, multi-master design. |
| React to inserts, updates, or deletes | DynamoDB Streams | Exposes item-change records to consumers such as Lambda. |
| Read exactly the latest successful write | Strongly consistent read | Avoids the stale-read possibility associated with eventual consistency. |
| Highest flexibility for irregular data | DynamoDB flexible schema | Items can contain varying attributes. |
| Restore to a precise recent second | Point-in-time recovery | Supports recovery to a second within the preceding 35 days. |
| Lower-cost storage for infrequently accessed data | Standard-Infrequent Access table class | Designed for data such as old logs or historical records. |
| Write many items efficiently | BatchWriteItem | Supports up to 25 items per request as described in the lesson. |
| Read many items efficiently | BatchGetItem | Supports up to 100 items from one or more tables. |
Common Traps / Misconceptions
- DynamoDB is not a relational SQL database. It is a NoSQL service with key-value and document capabilities.
- DAX is not required for ordinary DynamoDB use. It is the relevant choice when the scenario emphasizes microsecond latency.
- Global Tables are multi-master, but replication is asynchronous. A write in one Region is not necessarily visible in every other Region immediately.
- Items are not identical to rigid relational rows. DynamoDB uses flexible schemas, so items can have different attributes.
- Streams do not replace the table. They record item changes for downstream consumers.
PutItemandBatchWriteItemare not equivalent in scale.PutItemwrites one item, while the batch operation supports up to 25 items.GetItemandBatchGetItemdiffer in scope. The batch operation can retrieve up to 100 items from one or more tables.- Control-plane and data-plane permissions are different concerns. Creating a table is not the same as writing or querying items.
- Resource-based policies are not limited to tables. Indexes and streams are also DynamoDB sub-resources with their own ARNs.
- Eventually consistent reads are not necessarily incorrect. They are appropriate when the application can tolerate replication delay; strong consistency is selected when current data is required.
Real-World Engineer / Analyst Notes
- Start with the workload requirement rather than the feature name: latency, access frequency, geographic distribution, consistency, recovery precision, and event processing lead to different DynamoDB choices.
- Treat DAX as a targeted performance optimization. Confirm that the workload benefits from caching and that the requirement is truly microsecond-level latency.
- When designing event-driven processing with Streams, define what downstream action should occur for inserts, updates, and deletes. A deletion-triggered workflow, for example, can preserve an external record after the source item is removed.
- Keep table, index, and stream permissions as narrowly scoped as the workflow permits. Resource-specific ARNs are more precise than broad wildcards when the action supports resource restriction.
- Separate operational recovery requirements from replication requirements. Global Tables address multi-Region availability and writes; PITR and on-demand backups address restoration.
- When diagnosing a permissions issue, first determine whether the denied action is control plane or data plane, then inspect the relevant IAM identity policy or resource-based policy and resource ARN.
Quick Reference Summary
- DynamoDB: fully managed, serverless NoSQL database for key-value and document data.
- Architecture: tables distributed across partitions and replicated across multiple AZs in a Region.
- Scaling: horizontal and available without downtime when capacity is adjusted.
- Normal latency: milliseconds; microseconds: use DAX.
- Multi-Region, multi-master: Global Tables with asynchronous replication.
- Change processing: DynamoDB Streams, commonly consumed by Lambda.
- Consistency: eventually consistent or strongly consistent reads.
- Transactions: ACID transactions supported.
- Recovery: PITR to a second within 35 days and on-demand backup/restore.
- Table classes: Standard and Standard-Infrequent Access.
- Control plane: create, describe, list, update, and delete tables.
- Data plane:
PutItem,BatchWriteItem,GetItem,BatchGetItem,UpdateItem, andDeleteItem. - IAM: identity-based policies for users, groups, and roles; resource-based policies for tables, indexes, and streams.
Flashcards
Q: A workload requires microsecond-level latency for frequently accessed DynamoDB data. Which feature should you evaluate, and why?
A: Evaluate DynamoDB Accelerator (DAX). It is an in-memory cache placed in front of DynamoDB to reduce latency from the usual millisecond range to microseconds.
Q: When should Global Tables be selected instead of a single-Region DynamoDB table?
A: Select Global Tables when the application needs a fully managed multi-Region, multi-master database and must support writes in more than one Region.
Q: What replication characteristic must you remember about Global Tables?
A: Replication between Regions is asynchronous, so a write may not be visible in every Region immediately.
Q: A team must trigger AWS Lambda whenever an item is inserted, modified, or deleted. Which DynamoDB feature should it use?
A: Use DynamoDB Streams. Streams records item-level changes so downstream services such as Lambda can consume and process them.
Q: What is the difference between a DynamoDB table, item, and attribute?
A: A table is the data container, an item is an individual entry, and attributes are the named values associated with that item.
Q: When is a strongly consistent read preferable to an eventually consistent read?
A: Use a strongly consistent read when the application must see the latest successful write. Eventual consistency is acceptable when a short delay in reflecting changes is tolerable.
Q: Which API writes one item, and which API writes a batch of up to 25 items?
A: PutItem writes one item. BatchWriteItem writes up to 25 items and is more efficient for multiple writes.
Q: Which API retrieves up to 100 items from one or more tables?
A: BatchGetItem retrieves up to 100 items from one or more tables. GetItem retrieves a single item.
Q: How do control-plane and data-plane DynamoDB operations differ?
A: Control-plane operations manage or describe tables, such as creating or deleting one. Data-plane operations manipulate items through reads and writes, such as GetItem or PutItem.
Q: A company retains old application logs that are accessed infrequently. Which table class is the best fit from the lesson?
A: Standard-Infrequent Access is the appropriate choice because it provides lower-cost storage for infrequently accessed data.
Q: Which DynamoDB recovery feature restores a table to a specific second within the preceding 35 days?
A: Point-in-time recovery provides restoration to a specific second within that 35-day window.
Q: When would a resource-based policy be useful in DynamoDB?
A: Use a resource-based policy when permissions should be defined directly on a DynamoDB table, index, or stream for specified principals and actions.
Q: What is the trap in assuming every DynamoDB item has the same attributes?
A: DynamoDB has a flexible schema, so items in one table can contain different attributes. It should not be treated like a rigid relational table schema.
Practice Questions
Question 1
An application uses DynamoDB in two AWS Regions. Users may update their records in either Region, and the business wants AWS to manage replication between Regions. Which option best fits?
A. DynamoDB Streams
B. DAX
C. Global Tables
D. Standard-Infrequent Access
Correct answer: C. Global Tables
Explanation: Global Tables provide a fully managed multi-Region, multi-master configuration that supports writes in different Regions. Streams is for consuming item changes, while DAX is a cache.
Question 2
An operations workflow must preserve an external record whenever a DynamoDB item is deleted. Which design is most appropriate?
A. Use DynamoDB Streams and have Lambda process the deletion record.
B. Use DAX and configure it to retain deleted items.
C. Use DescribeTable after the deletion.
D. Change the table to Standard-Infrequent Access.
Correct answer: A. Use DynamoDB Streams and have Lambda process the deletion record.
Explanation: Streams records item changes, including deletions, and Lambda can consume those records for downstream processing.
Question 3
A monitoring requirement asks for the lowest possible read latency and specifically identifies microseconds as the target. Which architecture should be considered?
A. DynamoDB alone
B. DynamoDB with DAX
C. DynamoDB with PITR
D. Global Tables without caching
Correct answer: B. DynamoDB with DAX
Explanation: The lesson associates ordinary DynamoDB latency with milliseconds and microsecond latency with DAX, its in-memory caching layer.
Question 4
An IAM role should be able to query and scan only the books table. Which policy approach is most consistent with the lesson?
A. Allow all DynamoDB actions on all resources.
B. Use a policy allowing dynamodb:Query and dynamodb:Scan with the books table ARN as the resource.
C. Allow only dynamodb:ListTables on the books table ARN.
D. Attach a resource policy to DAX instead of granting DynamoDB permissions.
Correct answer: B. Use a policy allowing dynamodb:Query and dynamodb:Scan with the books table ARN as the resource.
Explanation: Query and scan are data-plane actions that can be restricted to a specific table resource. ListTables is a different control-plane action.
Question 5
An application must recover its DynamoDB table to the precise state at a particular second from three days ago. Which feature should be selected?
A. DynamoDB Streams
B. On-demand table class conversion
C. Point-in-time recovery
D. DAX cache invalidation
Correct answer: C. Point-in-time recovery
Explanation: Point-in-time recovery supports restoring to a specific second within the previous 35 days.
WordPress Metadata
Suggested Slug:
amazon-dynamodb-architecture-apis-security
Meta Description:
Study Amazon DynamoDB architecture, consistency, scaling, streams, DAX, global tables, APIs, table classes, backups, and IAM access control for the AWS Certified CloudOps Engineer Associate SOA-C03.
Tags:
Amazon DynamoDB, AWS Certified CloudOps Engineer, SOA-C03, NoSQL databases, DynamoDB Streams, DAX, Global Tables, DynamoDB APIs, IAM, AWS database services, DynamoDB backups