How to safely use AWS credentials in Dockerfile?

I need to copy a file from AWS S3 bucket; in my Dockerfile how can I use AWS credentials without putting them in the file?

Hi,

If you only need the AWS credentials during build time, you can set them as build time secrets that will get exposed to the image build but not propagate down to devices (more details can be found here https://www.balena.io/docs/learn/deploy/deployment/#build-time-secrets-and-variables). If you need to access them from the container, you can set them as environment variable from balena dashboard.

1 Like

Thank you for your quick response, sounds like a better approach, I’ll try it.