AWS Secret to File Command Line Utility
Background
AWS Secrets Manager is a powerful service for handling sensitive objects. In this service, you can store not only database credentials but also key-value pairs, plaintext, and binary secrets. It is often very useful to manage sensitive data (such as JKS, TLS certificates and keys, or SSH keys) in Secrets Manager and deliver it to your workload on demand.
I love this use case, and to simplify and speed up the process, I created a very simple tool to retrieve plaintext or binary secrets and save them to a local file. I mostly use it in sidecars or init containers to bring required data to my workload.
How to Use It
To download a binary secret, simply run:
1 | /bin/aws-secret-to-file --secret=/secret/name/here --output=./location/for/the/file --binary |
The same approach works for plaintext secrets. You can retrieve a single secret:
1 | /bin/aws-secret-to-file --secret=/secret/name/here --output=./location/for/the/file |
Or retrieve multiple secrets:
1 | /bin/aws-secret-to-file \ |
How to Get It
Pull the Docker image from GitHub.