Support for object level Tagging in boto3 upload_file method

Question:

I want to add tags to the files as I upload them to S3. Boto3 supports specifying tags with put_object method, however considering expected file size, I am using upload_file function which handles multipart uploads. But this function rejects ‘Tagging’ as keyword argument.

I found a way to make this work by using S3 transfer manager directly and modifying allowed keyword list.

Even though this works, I don’t think this is the best way. It might create other side effects. Currently I am not able to find correct way to achieve this. Any advice would be great. Thanks.

Answer:

Tagging directive is now supported by boto3. You can do the following to add tags:

Leave a Reply