Chapter 5 of 510% of exam

Data Stores and APIs

Choosing and modeling the right data store is central to AWS development. This chapter focuses on Amazon DynamoDB patterns and building APIs with Amazon API Gateway.

DynamoDB data modeling

DynamoDB is a fully managed NoSQL store where the partition key determines data distribution and an optional sort key enables range queries. Choose a high-cardinality partition key to avoid hot partitions. Use a Query for items sharing a partition key and reserve Scan for rare full-table reads because it is expensive.

Capacity, indexes, and streams

On-demand capacity scales automatically, while provisioned capacity with auto scaling can be cheaper for steady traffic. Global secondary indexes allow queries on non-key attributes. DynamoDB Streams emit item-level change events that can trigger Lambda for event-driven processing.

Building APIs with API Gateway

API Gateway exposes REST or HTTP APIs that integrate with Lambda, other AWS services, or HTTP backends. Stages let you deploy dev and prod separately, and stage variables parameterize integrations. Enable request validation and throttling to protect backends.

Consistency and transactions

DynamoDB reads are eventually consistent by default; request strongly consistent reads when you must see the latest write. Use conditional writes to enforce optimistic locking and TransactWriteItems for all-or-nothing updates across items.

Report