factored out some common s3 utils