Get Secet from AWS Secrets Manager via CLI

Here's how to use the aws cli to get a value for a secret out of secrets manager.

Using the aws cli can be so much more convenient than clicking through AWS web UIs to find what you want. An example of this is in the retrieval of secret values.

List All Secrets

If you need to see what secrets are in secrets manager, you can list them:

aws secretsmanager list-secrets --profile 

Optionally, use --profile to control what environment you're pulling from (as listed in ~/.aws/config).

Read a Secret Value

Once you know the available secrets, known by ids, you can retrieve the value for one of them, by secret id. Run:

aws secretsmanager get-secret-value --secret-id  --profile