Created
May 16, 2019 06:07
-
-
Save atroche/7841124818e3f2e8fd44ecd720d3e9ef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void copyFileToS3(File file, String contentType, String bucket, String key) { | |
PutObjectRequest request = new PutObjectRequest(bucket, key, file); | |
request.setCannedAcl(CannedAccessControlList.Private); | |
request.setStorageClass(StorageClass.ReducedRedundancy); | |
request.setMetadata(new ObjectMetadata()); | |
request.getMetadata().setContentType(contentType); | |
request.getMetadata().setServerSideEncryption(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION); | |
request.getMetadata().setCacheControl(String.format("public, max-age=%d", Duration.standardDays(90).getStandardSeconds())); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment