问题
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