How to Retrieve a Secret From AWS Secrets Manager in the CLI


If you have stored a secret in AWS using the Secrets Manager, it is possible to use the AWS CLI to retrieve this value at a later date.

aws secretsmanager get-secret-value --secret-id <ARN>

The arn is the Amazon Resource Name, which will look something like this:

aws secretsmanager get-secret-value --secret-id arn:aws:secretsmanager:<region>:<account>:<secretname>

Get a Secret from AWS Secrets Manager using the CLI

aws secretsmanager get-secret-value --secret-id arn:aws:secretsmanager:eu-west-1:4872719xxxxx:secret:NameOfOurSecret-xxx