0

After uploading a binary secret using something like

aws secretsmanager create-secret --name my-file-secret --secret-binary fileb://mysecret.file

I'm having trouble retrieving the file using the CLI.

How can I do this ?

maximede
  • 101
  • 2

1 Answers1

0

The secret is stored as a base64 encoded string in the SecretBinary field of the secret value.

To retrieve it, you need to : get the secret value, extract the SecretBinary from the resulting JSON, base64 decode it and then save in a file

aws secretsmanager get-secret-value --secret-id $SECRET_ID  --query SecretBinary --output text | base64 --decode > myretrievedsecret.file
maximede
  • 101
  • 2