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.

demandé il y a 2 ans2235 vues
2 réponses
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
répondu il y a 2 ans
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
répondu il y a 2 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions