I am trying to create one secrets manager using aws cli command .The command I tried is
aws secretsmanager create-secret \
--name sample_auth_aws_secret1 \
--description "My test secret created with the CLI." \
-- tags {"env":"dev","sample=test"} \
--secret-string "{\"clientId\":\"sample123\",\"secret\":\"wjwjwjwjwjwjwjsjsjsj\"}"
I am getting error usage: aws [options] [ ...] [parameters] To see help text, you can run:
aws help aws help aws help
Unknown options: env:dev, sample=test, --secret-string, {"clientId":"sample123","secret":"wjwjwjwjwjwjwjsjsjsj"}, tags
could you please help me on this .Thanks in advanced !
CodePudding user response:
There are two problems in your command.
- use --tags instead -- tags
- key value are not in correct json format.
please use below command
aws secretsmanager create-secret \
--name sample_auth_aws_secret1 \
--description "My test secret created with the CLI." \
--tags '{"Key":"CostCenter","Value":"12345"}' \
--secret-string "{\"clientId\":\"sample123\",\"secret\":\"wjwjwjwjwjwjwjsjsjsj\"}"
CodePudding user response:
You have a space here between the --
and tags
:
-- tags {"env":"dev","sample=test"} \
It should be:
--tags {"env":"dev","sample=test"} \
Also, you're syntax is totally wrong for setting tags. You're using :
in the first tag, and =
in the 2nd tag, but your overall syntax is wrong anyway. I suggest looking at the documentation and copying their examples.
It should be:
--tags [{"Key":"env","Value":"dev"},{"Key":"sample","Value":"test"}] \
CodePudding user response:
It has to do with the tags
that you are passing. You need a proper Key and Value assignment.
Try passing the working shorthand:
--tags Key="env",Value="dev" Key="sample",Value="test" \