I am writing a cron job that takes a Postgres table and upload the table to S3.
I am planning to do the following:
Convert the table to csv and store on disk.
Take file from disk and store in s3 using multipart put.
Delete file from disk.
Questions:
Should I copy the file to disk? Is there any way I can temporarly copy to disk without explicitly deleting the file once I have uploaded it?
Does doing this in memory make more sense? Postgres copy out only writes to OutputStream. AFAIK there is no way to upload a output stream to S3.