DynamoDB Streams

  • Streams here are ordered list of item level modification i.e., (create/update/delete) in a table.

  • Stream records can be sent to,

    • Kinesis Data Streams

    • AWS Lambda

    • KCL Applications

  • Data Retention for upto 24 hours

  • Use cases include,

    • React to changes in real-time.

    • Analytics

    • Insert into derivative tables.

    • Insert into OpenSearch service.

    • Implement cross-region replication.

  • Provides ability to choose the information that will be written to streams. The information includes,

    Attribute Name
    Description

    KEYS_ONLY

    Only attributes that will be modified

    NEW_IMAGE

    The entire items, as it appears after it was modified.

    OLD_IMAGE

    The entire items, as it appears before it was modified.

    NEW_AND_OLD_IMAGES

    Both new and old images of the item.

  • Streams are made of shards, just like Kinesis Data Streams.

  • You don't need to provisions shards, this is automated by AWS.

  • Records are not retroactively populated in a stream after enabling it.

Integration with Lambda

  • Define an Event Source Mapping to read from a DynamoDB Streams.

  • You need to ensure the lambda function have appropriate function.

  • Event Source Mapping will poll the data from the DynamoDB streams.

  • Trigger need to be set up so that lambda will be triggered.

  • Once above set up is done, Lambda will be ready to invoked synchronously for a batch of record fetched from DynamoDB streams.

Last updated