secretsmanager

Retrieve secrets securely using AWS Secrets Manager. View secrets by name with the AWS CLI. Free, fast, and easy to use.

AWS Secrets Manager

View Secret by Secret Name

Use the AWS CLI to retrieve a secret's value by specifying its name. This command securely fetches the secret string.

aws --profile default secretsmanager get-secret-value --secret-id my-db-secret --query SecretString --output text

Explanation

This command uses the aws secretsmanager get-secret-value command to retrieve the secret. The --secret-id parameter specifies the name of the secret to retrieve. The --query SecretString parameter specifies that only the secret string should be returned. The --output text parameter specifies that the output should be in plain text format.

Example Usage

To retrieve the secret named my-db-secret, run the following command:

aws --profile default secretsmanager get-secret-value --secret-id my-db-secret --query SecretString --output text

Additional Resources