AWS s3 putObject标记不起作用 [英] AWS s3 putObject Tagging is not working

查看:126
本文介绍了AWS s3 putObject标记不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用putObject方法将其上传到AWS s3时添加标签.根据文档,我已将标签创建为String类型.我的文件已上传到s3,但无法看到随附的文件对象的对象级别标签标记数据.

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

 });

推荐答案

这可能是由于用户的权限所致.我遇到了类似的问题,但是使用.NET,我可以添加标签,但随后无法查看它们.

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.

我后来发现,要添加标签,用户必须具有s3:PutObjectTagging权限,但是要查看添加的标签,用户还必须具有s3:GetObjectTagging权限.

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

这篇关于AWS s3 putObject标记不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆