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.

gefragt vor 2 Jahren2235 Aufrufe
2 Antworten
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
EXPERTE
beantwortet vor 2 Jahren
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
EXPERTE
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen