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,540 points
2,855 views

1 answer to this question.

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,170 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
• 58,020 points
3,944 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
• 58,020 points
2,798 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,640 points
8,090 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, 2019 in AWS by Priyaj
• 58,020 points
1,900 views
0 votes
1 answer
+1 vote
2 answers
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,170 points
1,676 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, 2019 in AWS by anonymous
22,294 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP