Skip to content

Instantly share code, notes, and snippets.

@siakon89

siakon89/upload_to_s3.py

Last active Apr 20, 2020
Embed
What would you like to do?
import boto3
from boto3.s3.transfer import TransferConfig
def upload_to_s3(file_name, bucket, key, region="us-east-1"):
# Multipart upload config
config = TransferConfig(
multipart_threshold=1024 * 25,
max_concurrency=10,
multipart_chunksize=1024 * 25,
use_threads=True,
)
s3 = boto3.client("s3", region_name=region)
# Upload file to S3
s3.upload_file(file_name, bucket, key, Config=config)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.