Search code examples
amazon-web-servicesaws-cliaws-secrets-manager

AWS: Assign tag to secret using variable


I want to assign variable's value to the secret. I tried this. aws secretsmanager tag-resource --secret-id blah-blah --tags '[{"Key": "abc", "Value": "{$a}"}]'

I'm getting this error: An error occurred (InvalidRequestException) when calling the TagResource operation: Request rejected by the downstream tagging service. Please check that you're only using allowed characters.

Any help with this???


Solution

  • You are using wrong characters and quotes. It should be:

    aws secretsmanager tag-resource --secret-id blah-blah --tags '[{"Key": "abc", "Value": "'${a}'"}]'