Amazon Web Services (AWS) - Update Secret using the AWS CLI

by
Jeremy Canfield |
Updated: June 05 2024
| Amazon Web Services (AWS) articles
This assumes you have already configured the aws command line tool. If not, check out my article on Getting Started with the AWS CLI.
The aws secretsmanager put-secret-value command can be used to update the key/value pairs in a secret.
aws secretsmanager put-secret-value \
--secret-string "{\"username\":\"john.doe\",\"password\":\"mynewpassword\"}" \
--secret-id arn:aws:secretsmanager:us-east-1:123456789012:secret:my-secret-SgNa1s
Optionally, the --version option can be used to create a new version of the secret.
aws secretsmanager put-secret-value \
--secret-string "{\"username\":\"john.doe\",\"password\":\"mynewpassword\"}" \
--secret-id arn:aws:secretsmanager:us-east-1:123456789012:secret:my-secret-SgNa1s \
--version 2
Did you find this article helpful?
If so, consider buying me a coffee over at