Joel no not that Joel
Joel no not that Joel

Reputation: 388

AWS cli s3api put-bucket-tagging not recognizing my TagSet

I'm using the following aws cli command. I've looked over it time after time and can't figure out what is wrong with the command.

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}]

I get the following error:

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]

What is wrong with the command?

Upvotes: 3

Views: 5064

Answers (2)

millionleaves
millionleaves

Reputation: 136

I used this solution to tag a bucket from a bash script:

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

I had to put the TagSet section in a separate variable for the tagging to work.

Upvotes: 0

Joel no not that Joel
Joel no not that Joel

Reputation: 388

The documentation in Amazon is incorrect so if you copy their example you will not be able to run the command. There were two things wrong with the CLI command:

1) There should not be s3:// in front of the bucket name.

2) There should be quotes around the TagSet i.e. "TagSet=[{Key=xxxxx,Value=ddddd}]" (this is not in the AWS documentation).

Upvotes: 9

Related Questions