簡體   English   中英

使用 aws cli 運行 create secrets manager 命令時出錯

[英]Getting error while running create secrets manager command using aws cli

我正在嘗試使用 aws cli 命令創建一個機密管理器。 我試過的命令是

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\"}"

我收到錯誤

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

Unknown options: env:dev, sample=test, --secret-string, {"clientId":"sample123","secret":"wjwjwjwjwjwjwjsjsjsj"}, tags

我做錯什么了?

--tags之間有一個空格:

-- tags {"env":"dev","sample=test"} \

它應該是:

--tags {"env":"dev","sample=test"} \

另外,設置標簽的語法完全錯誤。 您在第一個標記中使用: ,在第二個標記中使用= ,但您的整體語法無論如何都是錯誤的。 我建議查看文檔並復制他們的示例。

它應該是:

--tags [{"Key":"env","Value":"dev"},{"Key":"sample","Value":"test"}] \

它與您傳遞的tags有關。 您需要正確的鍵和值分配。

嘗試傳遞工作速記:

--tags Key="env",Value="dev" Key="sample",Value="test" \

你的命令有兩個問題。

  1. 使用 --tags 代替 --tags
  2. 鍵值的格式不正確 json。

請使用以下命令

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\"}"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM