This lab walks you through the steps to launch an Amazon DynamoDB table, configuring DynamoDB Streams and trigger a Lambda function to dump the items in the table as a text file and then move the text file to an S3 bucket.
You will practice it using Amazon DynamoDB, S3, and lambda.
Duration: 1 hour
AWS Region: US East (N. Virginia) us-east-1
Amazon DynamoDB is a fully managed NoSQL database service where maintenance, administrative burden, operative and scaling are taken care of by AWS.
We don't need to provide the specifications of how much we are going to save.
It provides single digit latency even for terabytes of data and is used for applications where very fast reads are required.
It is used in applications like gaming where data needs to be captured and changes take place very quickly.
Amazon DynamoDB stream is a feature that emits events when record modifications or changes occur in a DynamoDB table.
DynamoDB streams captures the time level modification in the DynamoDB table in a time ordered sequence.
When a DynamoDB stream is enabled, it captures the changes happening in the DynamoDB tables in an orderly manner.
DynamoDB streams can be used to replicate the data from one DynamoDB Table of region 1 to another DynamoDB Table of region 2.
Events can be of the following types:
Each event carries the contents of the rows that are being modified.
It records all the modifications through encrypted logs and stores them for 24 hours.
Whenever there is a change, DynamoDB creates a Stream records along with the primary key attribute of the items.
A DynamoDB Stream consists of stream record and an individual stream record, which represents a unique data modification in the DynamoDB table.
Each stream record is assigned through sequence numbering, which gives us the exact order in which the modification occurred.
Stream records are coupled into groups called shards. Each shard contains multiple stream records.
The shard also contains information required to access the stream records.
The stream records inside the shard will be time-limited with a lifetime of 24 hours and after that time the Stream records will be deleted automatically.
The shard can be split into multiple shards if needed for processing the records parallely with one parent shard and multiple child shards.
The order of processing will preference the parent first, followed by child shards.
Events are recorded in near real time.
In real time applications, we can access the stream records that contain events where changes take place.
The DynamoDB Streams can be configured to catch additional information like capturing the image of the modified items before and after the modification takes place.
The DynamoDB stream records can be read and processed with the help of the DynamoDB Streams endpoint.
Streams can be enabled while creating a DynamoDB table and can be disabled at any time.
Performance of the table won't be affected by both enabling and disabling the Streams because DynamoDB streams operate asynchronously.
Once the DynamoDB Stream is disabled, the data in the Stream will be available for 24 Hours. There is no methodology available for manually deleting the existing streams.
DynamoDB streams can be used as an event source for Lamda functions so you can create applications which take actions based on the events in the DynamoDB table.
The events that the DynamoDB captures can be analysed by moving the data into other AWS services like S3 or Cloudwatch.
In this lab we are going to:
Launch an Amazon DynamoDB table.
Insert items into the DynamoDB table.
Create a Lambda function.
Enable Triggers to the DynamoDB table.
Make changes to the contents of the DynamoDB Table.
While the changes take place in the DynamoDB table , the DynamoDB Streams will trigger the Lambda function which will push the data to S3 bucket as a text file.
Download and Verify the contents of the S3 bucket.