Home > Software design >  Attempting to update AWS secret isn't saving in AWS
Attempting to update AWS secret isn't saving in AWS

Time:04-12

I’m on Mac Monterrey. Using the AWS CLI, I want to update a secret's value, so I did this

aws secretsmanager update-secret --secret-id 'development/database' --description '{"adapter": "mysql2", "encoding": "utf8", "host": "host.docker.internal"}'

And I get back

{
    "ARN": "arn:aws:secretsmanager:us-east-1:1234678901234:secret:development/database-4walfE",
    "Name": "development/database"
}

However, when I go to see the value of my secret, it is unchanged

$ aws secretsmanager get-secret-value     --secret-id 'development/database'
{
    "ARN": "arn:aws:secretsmanager:us-east-1:1234678901234:secret:development/database-4abcdE",
    "Name": "development/database",
    "VersionId": "378861d2-c5f0-48a4-a965-13877321da62",
    "SecretString": "{\"adapter\": \"mysql2\", \"encoding\": \"utf8\", \"host\": \"127.0.0.1\"}",
    "VersionStages": [
        "AWSCURRENT"
    ],
    "CreatedDate": "2022-04-11T12:00:43.029000-05:00"
}

What gives? What am I missing?

CodePudding user response:

If you're updating the value of the secret, you should use --secret-string

aws secretsmanager update-secret --secret-id 'development/database' --secret-string '{"adapter": "mysql2", "encoding": "utf8", "host": "host.docker.internal"}'
  • Related