Skip to content

feat(aws): add DynamoDB Streams input component - #802

Open
danielavelez12 wants to merge 5 commits into
warpstreamlabs:mainfrom
decade-eng:daniela/dynamodb-streams
Open

feat(aws): add DynamoDB Streams input component#802
danielavelez12 wants to merge 5 commits into
warpstreamlabs:mainfrom
decade-eng:daniela/dynamodb-streams

Conversation

@danielavelez12

@danielavelez12 danielavelez12 commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a new aws_dynamodb_streams input that natively consumes change data capture (CDC) events from DynamoDB Streams.

  • New input: aws_dynamodb_streams — consumes CDC events with balanced shard assignment across multiple consumers
  • Checkpointing: DynamoDB-based checkpoint table (auto-created if configured) for at-least-once delivery
  • Shard balancing: Discovers shards, claims unclaimed ones, steals from overloaded clients — modeled after the existing Kinesis input
  • Full type mapping: Converts all DynamoDB attribute types (S, N, B, BOOL, NULL, SS, NS, BS, L, M) to JSON
  • Message metadata: Sets dynamodb_table, dynamodb_stream_arn, dynamodb_shard_id, dynamodb_event_id, dynamodb_event_name, dynamodb_sequence_number
  • Config fields: table or stream_arn, checkpoint, start_from_oldest, batching, plus standard AWS session fields

Adds a new `aws_dynamodb_streams` input that natively consumes change
data capture events from DynamoDB Streams. This resolves the inability
to use `aws_kinesis` with DynamoDB Stream ARNs due to ARN format
parsing issues.

Ref: warpstreamlabs#303

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@danielavelez12
danielavelez12 marked this pull request as draft April 6, 2026 18:32
danielavelez12 and others added 3 commits April 6, 2026 15:45
- Fix ack function returning stale error instead of downstream result,
  which silently swallowed output errors and broke at-least-once guarantees
- Use table name (stable) instead of stream ARN (changes on re-enable)
  as checkpoint key to prevent orphaned checkpoints
- Use random shard selection when stealing from overloaded clients
  instead of always targeting the first shard
- Pass explicit context to getShardIterator for consistency
- Use FieldDuration directly instead of manual string parsing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Parent-child ordering:
- Mark completed shards with a sentinel ClientID instead of deleting
  checkpoint entries, so child shards can verify parent completion
- Build parent-child dependency graph from shard metadata on each
  rebalance cycle and skip children whose parents haven't completed
- This prevents out-of-order delivery at shard split boundaries

TrimmedDataAccessException on GetRecords:
- Handle trimmed data errors during record fetching (not just iterator
  creation), which occurs when consumer lag exceeds 24h retention
- Reset the iterator to the configured starting position on trim

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Wait for checkpoint table to become ACTIVE after creation, preventing
  errors on first startup when the table is still in CREATING state
- Enable TTL on ExpiresAt attribute (best-effort) so completed shard
  entries auto-delete after 48 hours instead of accumulating forever
- Set ExpiresAt on completed shard entries (48h, well beyond the 24h
  DynamoDB Streams retention window)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's better to reuse the Kinesis checkpointer and add a Dynamo-DB specific Complete method (as well as add TTL cleanup)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think I'd prefer this. The overlap between these two components is very high so I'd be in favour of wherever we can re-use functionality

Adds integration tests using LocalStack 3.0 (older versions don't
return stream records). Tests cover basic CDC event consumption with
payload and metadata verification, and checkpoint table creation with
expected schema.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@danielavelez12
danielavelez12 marked this pull request as ready for review April 8, 2026 00:06
@jem-davies jem-davies assigned jem-davies and unassigned jem-davies May 18, 2026

@gregfurman gregfurman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey. Apologies for the delay here. Since this is a pretty large PR, it's non-trivial to review.

Do you think there's an opportunity here to create a common stream reader between this and the kinesis component that could perhaps alleviate a lot of this duplicated code?

Although more risky (since it'll be touching an otherwise widely used component), I'd be curious whether we could generalise the pattern we used out to other stream readers.

WDYT?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think I'd prefer this. The overlap between these two components is very high so I'd be in favour of wherever we can re-use functionality

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants