简体   繁体   中英

Secrets Manager can't find the specified secret value for staging label

I've been trying to create secret on the command line as follows:

~/$ aws secretsmanager create-secret --name first-secret
{
    "ARN": "arn:aws:secretsmanager:us-east-2:123456789012:secret:first-secret-9ez7W2",
    "Name": "first-secret"
}
~/$ aws secretsmanager get-secret-value --secret-id first-secret

An error occurred (ResourceNotFoundException) when calling the GetSecretValue operation: Secrets Manager can't find the specified secret value for staging label: AWSCURRENT

If I create secret on AWS Console (accepting default choices), I can "get-secret-value" without problem.

What's the difference between AWS Console and command line in this regard?

The (unhelpful) error message is thrown because the secret value hasn't been set after creation.

Here's how you can get things working:

$ aws secretsmanager create-secret --name first-secret
$ aws secretsmanager put-secret-value --secret-id first-secret --secret-string "foo@"
$ aws secretsmanager get-secret-value --secret-id first-secret

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM