Reputation: 29
What's the correct syntax to upload an object with multiple tags? Following command with 1 tag works fine:
aws s3api put-object --bucket mybucket --key something/obj.txt --body obj.txt --tagging "mykeyname1=myvalue1"
But following command with multiple tags generates error:
aws s3api put-object --bucket mybucket --key something/obj.txt --body obj.txt --tagging "mykeyname1=myvalue1, mykeyname2=myvalue2"
Error
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
Upvotes: 2
Views: 2401
Reputation: 16775
Unfortunately the documentation is not the best in this case. You can have multiple tags using the following format: key1=value1&key2=value2
For example:
aws s3api put-object --bucket mybucket --key something/obj.txt --body obj.txt --tagging 'mykeyname1=myvalue1&mykeyname2=myvalue2'
Upvotes: 6