pythonamazon-s3tagsboto3fme

How to add boto3 AWS S3 object tags in FME?


new to coding and researching a work project. There are many files stored in S3 buckets that are processed by FME automations. I want to be able to add S3 object tagging to my FME transformers so they are uploaded with the appropriate tags. I found some stuff about adding tags to buckets but I want to tag individual objects, with a Python caller or custom transformer in FME. Any guidance?


Solution

  • Boto3 and AWS CLI support object upload with tagging. An example would be (for boto3):

    import boto3
    
    client = boto3.client('s3')
    
    client.put_object(
        Bucket='bucket', 
        Key='key',
        Body='bytes', 
        Tagging='Key1=Value1'
    )
    

    I looked at the FME S3 Connector docs (http://docs.safe.com/fme/2020.0/html/FME_Desktop_Documentation/FME_Transformers/Transformers/s3connector.htm) and they only support metadata upload.

    You could use user-defined metadata key-pairs as an option if you need to use the FME transformers.

    S3 Metadata: https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingMetadata.html