AWS s3 putObject Tagging is not working

ⅰ亾dé卋堺 提交于 2020-06-16 17:38:33

问题


I am trying to add Tags while uploading to AWS s3 with putObject method.As per documentation I have created Tagging as String type.My file got uploaded to 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

 });

回答1:


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



来源:https://stackoverflow.com/questions/51674193/aws-s3-putobject-tagging-is-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!