How to upload data to s3 using aioboto3 without first writing to file?

244 views Asked by At

In all the examples of aioboto3 or aiobotocore, they use a method like 'upload_fileobj' which takes a file stream and uploads it.

I simply want to upload json and binary data which I have in memory. First writing it to file and then uploading it to s3 is inefficient. Not to say that writing to file inside docker can cause some issues. So how do I directly upload the data like we do in the boto library?

s3_client.put_object(
                Body=json.dumps(data),
                Bucket=bucket,
                Key=key
            )

Is there a precedence for this in aioboto3?

0

There are 0 answers