Lets say, we have to do some action for every item added to DynamoDB. We can use DynamoDB Streams along with Lambda to achieve the same.
Follow this article in Youtube
- AWS CLI pre-configured
-
git clone https://github.com/miztiik/dynamodb-streams-processor.git
-
Edit the
./helper_scripts/deploy.shto update your environment variables.AWS_PROFILE="default" BUCKET_NAME="sam-templates-011" # bucket must exist in the SAME region the deployment is taking place SERVICE_NAME="dynamodb-stream-processor" TEMPLATE_NAME="${SERVICE_NAME}.yaml" STACK_NAME="${SERVICE_NAME}" OUTPUT_DIR="./outputs/" PACKAGED_OUTPUT_TEMPLATE="${OUTPUT_DIR}${STACK_NAME}-packaged-template.yaml"
-
We will use the
deploy.shin thehelper_scriptsdirectory to deploy our AWS SAM templatechmod +x ./helper_scripts/deploy.sh ./helper_scripts/deploy.sh
-
Insert a simple item to the table, either from the GUI/CLI
ddb_name="dynamodb-stream-processor-DynamoDBTable-N8Z22Q0GILUH" for i in {1..10} do val=${RANDOM} aws dynamodb put-item \ --table-name "${ddb_name}" \ --item '{ "Username": {"S":"User_'${i}'"},"Timestamp": {"S":"'$(date +"%d/%m/%Y-%H:%M:%S")'"},"Message":{"S":"Mystique_Msg_'${val}'"} }' done
You can reach out to us to get more details through here.
