CmdID

CmdID / Commands

aws-secretsmanager

Store, manage, and retrieve secrets. tldr-pages

On several platforms

Opens CmdID with your command. It is read in your browser and sent nowhere.

Several platforms

from tldr-pages, CC BY 4.0

Show secrets stored by the secrets manager in the current account

aws secretsmanager list-secretsIdentify

List all secrets but only show the secret names and ARNs (easy to view)

aws secretsmanager list-secrets --query 'SecretList[*].{Name: Name, ARN: ARN}'Identify
--queryA JMESPath query to use in filtering the response data. AWS CLI reference

Create a secret

aws secretsmanager create-secret --name name --description "secret_description" --secret-string 'secret'Identify
--nameThe name of the new secret. AWS CLI reference
--descriptionThe description of the secret. AWS CLI reference
--secret-stringThe text data to encrypt and store in this new version of the secret. AWS CLI reference

Delete a secret (append --force-delete-without-recovery to delete immediately without any recovery period)

aws secretsmanager delete-secret --secret-id nameIdentify
--secret-idThe ARN or name of the secret to delete. AWS CLI reference

View details of a secret except for secret text

aws secretsmanager describe-secret --secret-id nameIdentify
--secret-idThe ARN or name of the secret. AWS CLI reference

Retrieve the value of a secret (to get the latest version of the secret omit --version-stage)

aws secretsmanager get-secret-value --secret-id name --version-stage version_of_secretIdentify
--secret-idThe ARN or name of the secret to retrieve. AWS CLI reference
--version-stageThe staging label of the version of the secret to retrieve. AWS CLI reference

Rotate the secret immediately using a Lambda function

aws secretsmanager rotate-secret --secret-id name --rotation-lambda-arn arn_of_lambda_functionIdentify
--secret-idThe ARN or name of the secret to rotate. AWS CLI reference
--rotation-lambda-arnFor secrets that use a Lambda rotation function to rotate, the ARN of the Lambda rotation function. AWS CLI reference

Rotate the secret automatically every 30 days using a Lambda function

aws secretsmanager rotate-secret --secret-id name --rotation-lambda-arn arn_of_lambda_function --rotation-rules AutomaticallyAfterDays=30Identify
--secret-idThe ARN or name of the secret to rotate. AWS CLI reference
--rotation-lambda-arnFor secrets that use a Lambda rotation function to rotate, the ARN of the Lambda rotation function. AWS CLI reference
--rotation-rulesA structure that defines the rotation configuration for this secret. AWS CLI reference