I have a service that runs daily which purpose is to export delta from Postgres DB and upload it to S3 bucket.
I'm using CopyManager
and the copyOut
method.
In the copyOut
I have 2 options:
a) Writer
b) OutputStream
On the other hand I have Amazon S3 client which has this PutObjectRequest
that accepts File
or InputStream
.
Currently we have 2 ways of doing this:
1. Export to file and upload from file
2. Export to ByteArrayOutputStream
and get they underlying byte[]
and pass this to the InputStream of S3 uploader
Is it possible to somehow connect those 2 that we wouldn't have to use this intermediary file nor a possibly very large byte array?
In other words I would like to directly upload the db delta