AWS cli s3api put-bucket-tagging无法识别我的TagSet

时间:2016-03-03 19:57:18

标签: amazon-web-services amazon-s3 aws-cli

我使用以下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]

该命令有什么问题?

2 个答案:

答案 0 :(得分:6)

亚马逊的文档不正确,因此如果您复制他们的示例,您将无法运行该命令。 CLI命令有两个问题:

1)在存储桶名称前面不应该有s3://。

2)TagSet周围应该有引号,即“TagSet = [{Key = xxxxx,Value = ddddd}]”(这不在AWS文档中)。

答案 1 :(得分:0)

我使用以下解决方案从bash脚本中标记了存储桶:

customer="customername"
awsbucket="bucketname"
tag="TagSet=[{Key=Customer,Value=$customer}]"
aws s3api put-bucket-tagging --bucket $awsbucket --tagging $tag

我必须将TagSet部分放在一个单独的变量中,以便标记起作用。

相关问题