def upload_to_s3(file_list, bucket_name): conn = boto3.resource('s3', aws_access_key_id=aws_access_key, aws_secret_access_key=aws_secret_key, config=Config(signature_version='s3v4')) for file in file_list: print('Uploading: ' + file + '\n') remote_name = file.split('/') conn.Object(bucket_name, file).put(Body=open(log_dir + file, 'rb'))