I am using aws-sdk-core v2.2.37 as I cannot upgrade for various reasons.
Despite the documentation clearly showing that I can add a tag to the object with the "tagging" key.
https://docs.aws.amazon.com/sdk-for-ruby/v2/api/Aws/S3/Client.html#put_object-instance_method
The code,
resp = s3.put_object(
{
bucket:"osworkerfiles",
key:"testingtags457",
body:"testing123456",
tagging:"key1=value1"
})
Edit: I have also tried "tags"
always returns
The request without the tagging key works - is there something I am doing wrong here?
The version of the SDK you are using (
v2.2.37
) is 5 years old (April 2016). Object tagging in S3 wasn't released until December of 2016 so the version of the SDK you are using doesn't have this feature enabled yet.Even if you can't use v3 of the SDK, you'll at least need to upgrade to a more recently version of the v2 SDK. The latest version is 2.11 but anything > 2.7 should include the S3 object tagging feature.
Reference: https://rubygems.org/gems/aws-sdk-core/versions