问题描述
我正在尝试使用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标记不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!