Created
February 3, 2026 06:11
-
-
Save ghaering/1a90bb3501070319d77f39caed5ebb0b to your computer and use it in GitHub Desktop.
upload to s3 using multipart upload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import boto3 | |
| from boto3.s3.transfer import TransferConfig | |
| s3_client = boto3.client("s3", region_name="eu-central-1") # Your region | |
| BUCKET = "gerhard-s3-upload-test" | |
| KEY = "big" | |
| FILE_PATH = "big_file.txt" | |
| # Customize threshold (e.g., 64 MB) and concurrency for large files | |
| config = TransferConfig( | |
| multipart_threshold=64 * 1024 * 1024, # 64 MB | |
| max_concurrency=10, # Parallel parts | |
| multipart_chunksize=64 * 1024 * 1024, # Part size 64 MB (5 MB min) | |
| ) | |
| s3_client.upload_file( | |
| FILE_PATH, | |
| BUCKET, | |
| KEY, | |
| Config=config, | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment