How to set-up DynamoDB trigger using AWS Lambda?

0 votes

I'm trying to create a DynamoDB trigger using DynamoDB Streams and AWS Lambda.But I am not very familiar with AWS Services yet, so i don’t know but how to read and process a DynamoDB Stream event in Java 8.

Essentially, what I want to do is create a record in table B whenever a record is created in table A.

Could any of you please point me to a code or post that handles this use case in Java?

Aug 20, 2018 in AWS by datageek
• 2,430 points
357 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Well this code worked for me. You can use it to receive and process DynamoDB events in a Lambda function -

public class Handler implements RequestHandler<DynamodbEvent, Void> {

    @Override
    public Void handleRequest(DynamodbEvent dynamodbEvent, Context context) {

        for (DynamodbStreamRecord record : dynamodbEvent.getRecords()) {

            if (record == null) {
                continue;
            }

            // Your code here
            // Write to Table B using DynamoDB Java API
        }

        return null;
    }
}
When you create your Lambda, add the stream from table A as your event source, and that's it.
answered Aug 20, 2018 by Archana
• 4,090 points

Related Questions In AWS

0 votes
1 answer
0 votes
1 answer

How to create new stack using create-change-set in AWS Cloudformation

The type of change set operation. To ...READ MORE

answered Sep 18, 2018 in AWS by Priyaj
• 56,140 points
159 views
0 votes
1 answer

How to access AWS Lambda environment variables using Java?

In Spring Core change the PropertySourcesPlaceholderConfigurer class can ...READ MORE

answered Oct 24, 2018 in AWS by Priyaj
• 56,140 points
355 views
0 votes
1 answer

How to set up AWS credentials in AWS Powershell?

First, of all the tools installed to ...READ MORE

answered Nov 22, 2018 in AWS by Archana
• 5,360 points
246 views
0 votes
1 answer

How to create a DynamoDB using AWS CLI?

You can create a DynamoDB table using ...READ MORE

answered Feb 22 in AWS by Priyaj
• 56,140 points
29 views
0 votes
1 answer
0 votes
1 answer

How to set up a SPF(Sender Policy Framework) for AWS EC2 instance?

Setting up a SPF record is pretty ...READ MORE

answered Aug 16, 2018 in AWS by Archana
• 4,090 points
115 views
0 votes
2 answers

How to display just the name of files using aws s3 ls command?

aws s3 ls s3://<your_bucket_name>/ | awk '{print ...READ MORE

answered Mar 17 in AWS by anonymous
1,705 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.