Is it possible to use Protocol Buffers with DynamoDB.

0

Hi,

I an trying to use Protocol Buffers in AWS lambda to generate java class and data object. how can I use Protocol Buffers generated data to store in dynamo DB, so that I can reduce the data size.

asked 2 years ago2204 views
2 Answers
2

Your question is a little vague, are you asking how to store the protobuf data in DynamoDB? You can store binary data in DynamoDB using the Binary Data Type listed here.

I've not used protobufs in Java, but I have in Node using the protobufjs NPM package. I am sure you can do likewise by adding a needed package to your pom file.

profile pictureAWS
EXPERT
answered 2 years ago
1

DynamoDB API only support JSON, hence to store binary data, that is your Protobuf encoded payload, you need to first convert it to Base64. https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Programming.LowLevelAPI.html#Programming.LowLevelAPI.Binary

The stored binary data occupies the raw byte length.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/CapacityUnitCalculations.html

You can also handle binary data in Java using the Document API. https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/JavaDocumentAPIBinaryTypeExample.html

AWS
EXPERT
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions