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

by
Jeremy Canfield |
Updated: June 02 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 list-secrets command can be used the list the secrets you have created.
]$ aws secretsmanager list-secrets
{
"SecretList": [
{
"ARN": "arn:aws:secretsmanager:us-east-1:123456789012:secret:my-secret-tD1U2U",
"Name": "my-secret",
"Description": "my-secret",
"LastChangedDate": "2023-08-23T17:23:54.741000-05:00",
"LastAccessedDate": "2023-08-22T19:00:00-05:00",
"SecretVersionsToStages": {
"0a8aa38f-b95e-42ab-acc9-7745aa710f23": [
"AWSCURRENT"
]
},
"CreatedDate": "2023-08-23T17:23:54.435000-05:00"
}
]
}
Then the aws secretsmanager delete-secret command can be used to delete a secret.
aws secretsmanager delete-secret --secret-id arn:aws:secretsmanager:us-east-1:123456789012:secret:my-secret-tD1U2U
Did you find this article helpful?
If so, consider buying me a coffee over at