There is a --tagging option for s3api put-object command (like explained in this documentation http://docs.aws.amazon.com/cli/latest/reference/s3api/put-object.html), but it seems not working and throw the following errors:
aws s3api put-object [...] --tagging 'TagSet%3D%5B%7BKey%3Dstring%2CValue%3Dstring%7D%5D'
An error occurred (InvalidTag) when calling the PutObject operation: The TagKey you have provided is invalid
or:
aws s3api put-object [...] --tagging 'TagSet=[{Key=string,Value=string}]'
An error occurred (InvalidArgument) when calling the PutObject operation: The header 'x-amz-tagging' shall be encoded as UTF-8 then URLEncoded URL query parameters without tag name duplicates
I'm using an AWS key with AdministratorAccess on target bucket.
aws --version
aws-cli/1.11.154 Python/2.7.13 Linux/4.12.11-300.fc26.x86_64 botocore/1.7.12
Any idea ? Many thanks !
You want to use 'testing=Moo' as the value of --tagging. It is encoding the key values as a query string.
That's not true. This worked for me: aws s3api put-object-tagging --bucket my_bucket --key my.file --tagging 'TagSet=[{Key=mykey,Value=myvalue},{Key=yourkey,Value=yourvalue}]'
@rtvlad You've quoted put-object-tagging rather than put-object. The commands seem to have different behaviour
@dstufft Any ideas when you want to give multiple tags? 'testing=Moo,testing2=Baa' does not seem to work
EDIT... 'testing=Moo&testing2=Baa' works
Most helpful comment
@dstufft Any ideas when you want to give multiple tags?
'testing=Moo,testing2=Baa'does not seem to workEDIT...
'testing=Moo&testing2=Baa'works