CmdID / aws / aws secretsmanager
aws secretsmanager tag-resource
Attaches tags to a secret. AWS CLI reference
2 examples 2 options Its page in the AWS CLI reference
Examples
Example 1: To add a tag to a secret
The following tag-resource example attaches a tag to a secret by using shorthand syntax.
aws secretsmanager tag-resource --secret-id MyTestSecret --tags Key=FirstTag,Value=FirstValueIdentify--secret-idThe identifier for the secret to attach tags to.--tagsThe tags to attach to the secret as a JSON text string argument.This command produces no output.
For more information, see Tag your secrets in the Secrets Manager User Guide.
Example 2: To add multiple tags to a secret
The following tag-resource example attaches two key-value tags to a secret.
aws secretsmanager tag-resource --secret-id MyTestSecret --tags '[{"Key": "FirstTag", "Value": "FirstValue"}, {"Key": "SecondTag", "Value": "SecondValue"}]'Identify--secret-idThe identifier for the secret to attach tags to.--tagsThe tags to attach to the secret as a JSON text string argument.This command produces no output.
For more information, see Tag secrets in the Secrets Manager User Guide.
Options
--secret-idThe identifier for the secret to attach tags to.--tagsThe tags to attach to the secret as a JSON text string argument.