Connecting balena to AWS dynamodb

Hi, I am working on a project that requires I setup balena with aws dynamodb. Anyone with an idea on doing that?

Hi, there should not be any issues with using dynamodb in a balena application. Are you looking forward to install dynamodb locally in a container or to use it remotely?
Thanks,
Zahari

I’m setting it up remotely. Please do assist

Hi Daniel,
I would suggest you to try using one of the SDKs that AWS offers for DynamoDB, based on which programming language that you prefer.
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GettingStarted.html

You can then either start you base image from scratch, or use one of the balena base images that we offer that already have the libraries for your language of choice installed.
https://www.balena.io/docs/reference/base-images/base-images/#features-overview

On top of that you will only have to follow the DynamoDB SDK installation instructions. For example if you were to choose the node.js DynamoDB SDK, you could use the node.js balenalib base image and then install the DynamoDB node.js SDK following the instructions at:
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GettingStarted.NodeJs.html

Your Dockerfile.template would probably look like this:

FROM balenalib/%%BALENA_MACHINE_NAME%%-debian-node:12-stretch-run

RUN npm install aws-sdk

# CMD the start script of your application

Let me also point you to our documentation page with the list of base images that we provide:

In order to keep the aws keys separate from your code, you can then either use built time secrets, or plain environment variables (but b/c of the security concerns built time secrets are the suggested way to do this, at least when going to production).
Let me point you to our documentation pages about built time secrets and environment variables:


https://www.balena.io/docs/learn/manage/serv-vars/#environment-and-service-variables

Kind regards,
Thodoris

Let me also point you to our documentation page about integrating AWS IoT with balenaCloud. Even though that guide isn’t about DynamoDB, the process described there is quite similar to the one that you will have to follow. Moreover there are some sample repositories near the bottom that might be a good starting point for your project.

Thanks a lot, I’ll surely check them out