Test Mail
Test Mail

Reputation: 309

Amazon s3 putObject Tagging is not working

I am trying to add Tags while uploading to Amazon s3 with putObject method.As per documentation I have created Tagging as String type.My file got uploaded to Amazon s3 but I am unable to see object level Tags of file object with the supplied tags data.

Following code sample as per documentation

var params = {
  Body: <Binary String>, 
  Bucket: "examplebucket", 
  Key: "HappyFace.jpg", 
  Tagging: "key1=value1&key2=value2"
 };
 s3.putObject(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response

 });

Upvotes: 5

Views: 6586

Answers (1)

Kikanye
Kikanye

Reputation: 1368

This may be due to the permissions on the user. I had a similar issue but with .NET, I could add the tags but then I could not view them.

I later found that to add tags the user must have the s3:PutObjectTagging permission, but to view the added tags the user must also have the s3:GetObjectTagging permission.

Basically you want to confirm that you have both of these permissions for the user. Hope this helps

Upvotes: 6

Related Questions