Skip to content

Chapter 7 of 8

Databases, Messaging, and Event-Driven Integration

For managed NoSQL, DynamoDB offers single-digit millisecond performance with built-in security, backup, and multi-region replication. Its primary keys come in two flavors: a partition key (hash) only, which distributes items across partitions, or a composite primary key combining a partition key with a sort key so items in the same partition are ordered for range queries. A partition holds up to 10 GB and serves up to 3,000 RCUs and 1,000 WCUs; a hot partition occurs when one partition receives disproportionate traffic, often from a skewed key, leading to throttling.

Capacity is metered in RCUs and WCUs. Read capacity units bill as one RCU per strongly consistent read of up to 4 KB, 0.5 RCU for an eventually consistent read of the same size, and 2 RCU for a transactional read, all rounded up to 4 KB. Write capacity units bill as one WCU per standard write of up to 1 KB and 2 WCUs per transactional write of the same size, rounded up to 1 KB. On-demand mode charges per request for unpredictable workloads, while auto scaling adjusts provisioned RCU/WCU within a min/max band to keep a target utilization (default 70%) using Application Auto Scaling.

Indexes extend the table: a Local Secondary Index uses the same partition key as the base table with a different sort key, shares throughput and storage, and must be defined at table creation (10 GB per partition limit). A Global Secondary Index uses its own partition key and optional sort key, has its own provisioned or on-demand throughput, can be added or modified after table creation, and is not constrained to 10 GB per partition. DynamoDB transactions provide ACID guarantees across up to 100 items in one or more tables in a single account and region through TransactGetItems and TransactWriteItems, doubling WCU/RCU. DynamoDB Streams retain item-level changes for 24 hours and trigger Lambda, replication, or materialized views. DynamoDB TTL deletes items whose timestamp attribute has passed at no cost, generally within 48 hours. DynamoDB DAX is a fully managed in-memory cache, API-compatible with DynamoDB, that delivers up to 10x read performance and runs inside a single VPC. DynamoDB Global Tables provide multi-region, multi-active replication with synchronous writes and last-writer-wins conflict resolution.

For messaging, Amazon SNS provides pub/sub fan-out to SQS queues, Lambda functions, HTTP/S endpoints, email, SMS, and mobile push, with no message retention. Amazon SQS provides durable message queues with retention up to 14 days (default 4 days), consumers that poll for messages, and both standard queues (best-effort ordering, at-least-once delivery, unlimited throughput) and FIFO queues (exactly-once processing, first-in-first-out, 300 messages per second without batching or 3,000 with batching, names must end with .fifo). The visibility timeout (default 30 s, max 12 h) hides a message from other consumers after it is received; if the consumer does not delete the message before expiry, it becomes visible again. The maximum SQS message size is 256 KB, so larger payloads go in S3 and only an S3 reference is sent, following the Amazon SQS Extended Client for Java pattern. A dead-letter queue receives messages that failed processing after the redrive policy's maxReceiveCount is exceeded, and one DLQ can be shared by up to 100 source queues. Long polling, the recommended default, waits up to 20 seconds for messages to arrive, reducing empty ReceiveMessage responses and cost compared to short polling.

Amazon EventBridge is the serverless event bus that ingests events from AWS services, SaaS apps, and custom sources and routes them to targets such as Lambda, SQS, SNS, and Step Functions via rules with event patterns or schedules. It is the evolution of CloudWatch Events, adding a schema registry, archive and replay, cross-account event buses, and third-party SaaS integrations; existing CloudWatch Events accounts continue to work via the default EventBridge bus. AWS Step Functions coordinates multiple AWS services into workflows using state machines defined in Amazon States Language (JSON), with standard workflows for long-running, exactly-once workloads and express workflows for high-volume, at-least-once processing.

All chapters
  1. 1AWS Foundations and the Shared Responsibility Model
  2. 2Identity, Access, and Authentication
  3. 3Compute, Containers, and Deployment
  4. 4Serverless with Lambda
  5. 5Storage on AWS
  6. 6Networking and Application Delivery
  7. 7Databases, Messaging, and Event-Driven Integration
  8. 8Observability, Security, and DevOps Practices

Drill it

Reading is not remembering. These come from the AWS Developer Associate Dva C02 deck:

Q

What does the AWS shared responsibility model define?

The division of security responsibilities between AWS (security OF the cloud: infrastructure, hardware, regions, services) and the customer (security IN the clo...

Q

Which AWS service is required to launch an EC2 instance?

An AMI (Amazon Machine Image), an instance type, a VPC with subnet, a security group, an IAM role/credentials, and optionally key pair and EBS volume.

Q

What is an IAM role vs an IAM user?

An IAM user is a permanent identity with long-lived credentials. An IAM role is an identity with no long-lived credentials that is assumed temporarily by users,...

Q

What is the maximum size of an IAM policy?

5,120 characters for managed policies attached to a user/group/role; service-specific quotas apply (e.g. inline user policy up to 2,048 chars, group 5,120, role...