[英]AWS cli s3api put-bucket-tagging - cannot add tag to bucket unless bucket has 0 tags
[英]AWS cli s3api put-bucket-tagging not recognizing my TagSet
我正在使用以下 aws cli 命令。 我一次又一次地查看它,但無法弄清楚命令有什么問題。
aws s3api put-bucket-tagging --bucket s3://****edited**** --tagging TagSet=[{Key=Name,Value=FHWA_Packaging_Logs},{Key=Project,Value=FHWA_Processing},{Key=Team,Value=Production}]
我收到以下錯誤:
Unknown options: TagSet=[Key=Name,Value=FHWA_Processing,Key=Team], TagSet=[Key=Name,Value=FHWA_Processing,Value=Production], TagSet=[Value=FHWA_Packaging_Logs,Key=Project,Key=Team], TagSet=[Value=FHWA_Packaging_Logs,Key=Project,Value=Production], TagSet=[Value=FHWA_Packaging_Logs,Value=FHWA_Processing,Key=Team], TagSet=[Value=FHWA_Packaging_Logs,Value=FHWA_Processing,Value=Production], TagSet=[Key=Name,Key=Project,Value=Production]
命令有什么問題?
Amazon 中的文檔不正確,因此如果您復制他們的示例,您將無法運行該命令。 CLI 命令有兩處錯誤:
1)bucket名稱前不能有s3://。
2) 標簽集周圍應該有引號,即“TagSet=[{Key=xxxxx,Value=ddddd}]”(這不在 AWS 文檔中)。
我使用此解決方案從 bash 腳本標記存儲桶:
customer="customername"
awsbucket="bucketname"
tag="TagSet=[{Key=Customer,Value=$customer}]"
aws s3api put-bucket-tagging --bucket $awsbucket --tagging $tag
我不得不將 TagSet 部分放在一個單獨的變量中,以便標記工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.