Someone on stack overflow has this recipe to directly pipe the file through without a temporary file: ``` pg_dump -Z 9 -v -h ${DATABASE_HOST} -U ${DATABASE_USER} -d ${DATABASE_NAME} | aws s3 cp --storage-class STANDARD_IA --sse aws:kms - s3://my-bucket/dump.sql.gz ``` I wonder if that would be an improvement over what you have here.