AWS does let you add tags to an existing S3 bucket, using the console, or this http api for instance: https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObjectTagging.html
But rather than use the HTTP API directly, is there any way to use the ruby AWS SDK v3 to add (or remove?) tags to an existing S3 object?
I haven't been able to figure it out.
CodePudding user response:
OK, answering my question, I eventually found a method on Aws::S3::Client
s3_client = Aws::S3::Client.new
s3_client.put_object_tagging({
bucket: "bucket_name",
key: "some/key.jpg",
tagging: {
tag_set: [
{
key: "tag-name",
value: "tag value",
}
]
}
})
i was expecting there to be a method on Aws::S3::Bucket
or Aws::S3::Object
, but if there is I can't figure it out! But I have verified this one on Aws::S3::Client
as working for me.