简体   繁体   中英

How to upload HDF5 file directly to S3 bucket in Python

I want to upload a HDF5 file created with h5py to S3 bucket without saving locally using boto3.

This solution uses pickle.dumps and pickle.loads and other solutions I have found, store the file locally which I like to avoid.

You can use io.BytesIO() to and put_object as illustrated here 6 . Hope this helps. Even in this case, you'd have to 'store' the data locally(though 'in memory'). You could also create a tempfile.TemporaryFile and then upload your file with put_object . I don't think you can stream to an S3 Buckets in the sense that the local data would be discarded as it is uploaded to the Bucket.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM