code: def update_file(finfo, sample_info, config):
      
      ffinal = filesystem.update_file(finfo, sample_info, config, pass_uptodate=True)
      if os.path.isdir(ffinal):
          to_transfer = []
          for path, dirs, files in os.walk(ffinal):
              for f in files:
                  full_f = os.path.join(path, f)
                  k = full_f.replace(os.path.abspath(config["dir"]) + "/", "")
                  to_transfer.append((full_f, k))
      else:
          k = ffinal.replace(os.path.abspath(config["dir"]) + "/", "")
          to_transfer = [(ffinal, k)]
  
      region = "@%s" % config["region"] if config.get("region") else ""
      fname = "s3://%s%s/%s" % (config["bucket"], region, to_transfer[0][1])
      conn = objectstore.connect(fname)
      bucket = conn.lookup(config["bucket"])
      if not bucket:
          bucket = conn.create_bucket(config["bucket"], location=config.get("region", "us-east-1"))
  
      for fname, orig_keyname in to_transfer:
          keyname = os.path.join(config.get("folder", ""), orig_keyname)
          key = bucket.get_key(keyname) if bucket else None
          modified = datetime.datetime.fromtimestamp(email.utils.mktime_tz(
              email.utils.parsedate_tz(key.last_modified))) if key else None
          no_upload = key and modified >= finfo["mtime"]
          if not no_upload:
              _upload_file_aws_cli(fname, config["bucket"], keyname, config, finfo)
docs: Update the file to an Amazon S3 bucket, using server side encryption.