Retrieve secrets from AWS Secrets Manager - AWS Secrets Manager

Retrieve secrets from AWS Secrets Manager

You can retrieve your secrets by using the console (https://console.aws.amazon.com/secretsmanager/) or the AWS CLI (get-secret-value).

In applications, you can retrieve your secrets by calling GetSecretValue in any of the AWS SDKs. You can also call the HTTPS Query API directly. However, we recommend that you cache your secret values by using client-side caching. Caching secrets improves speed and reduces your costs.

Within other systems and AWS services

You can also retrieve secrets within the following:

AWS CLI

Example Retrieve the encrypted secret value of a secret

The following get-secret-value example gets the current secret value.

aws secretsmanager get-secret-value \ --secret-id MyTestSecret

Example Retrieve the previous secret value

The following get-secret-value example gets the previous secret value.

aws secretsmanager get-secret-value \ --secret-id MyTestSecret --version-stage AWSPREVIOUS