본문 바로가기
CLOUD/AWS

aws s3 sdk acl 지정

by Rainbound-IT 2022. 10. 27.
반응형

 

 

put에 acl 지정

 

amazonS3Client.putObject(new PutObjectRequest(bucket, fileName, inputStream, metadata).withCannedAcl(CannedAccessControlList.PublicRead));

 

BucketOwnerFullControl 을 PublicRead라던가 바꾸면됨

/* Create an Object of CopyObjectRequest */
            /* Arguments: SourceBucketName, SourceObjectKey, DestinationBucketName, DestinationObjectKey */
            CopyObjectRequest request = new CopyObjectRequest("bucket-1", "s3.png", "bucket-2", "s3.png");
             
            /* Set StorageClass as Standard Infrequent Access */
            request.setStorageClass(StorageClass.StandardInfrequentAccess);
             
            /* Set Canned ACL as BucketOwnerFullControl */
            request.setCannedAccessControlList(CannedAccessControlList.BucketOwnerFullControl);

 

 

 

 

copy object 예시

https://codedestine.com/aws-s3-copy-object-java/

 

How to copy object stored in S3 bucket using Java - AWS S3 Copy Object

Learn how to copy an object from one S3 bucket to another S3 bucket using java language. AWS S3 Copy Object, AWS S3 Tutorial using Java

codedestine.com

 

CannedAccessControlList 공식문서

https://javadoc.io/doc/com.amazonaws/aws-java-sdk-s3/1.9.18/com/amazonaws/services/s3/model/CannedAccessControlList.html

 

CannedAccessControlList - aws-java-sdk-s3 1.9.18 javadoc

Latest version of com.amazonaws:aws-java-sdk-s3 https://javadoc.io/doc/com.amazonaws/aws-java-sdk-s3 Current version 1.9.18 https://javadoc.io/doc/com.amazonaws/aws-java-sdk-s3/1.9.18 package-list path (used for javadoc generation -link option) https://jav

javadoc.io

 

.acl(ObjectCannedACL.PUBLIC_READ)

put object 

java - Upload a file to AWS S3 with public access granted - Stack Overflow

 

Upload a file to AWS S3 with public access granted

I have a S3 bucket that is defined with public access, nevertheless, when I upload a file into it, and access to the URL I have an access denied error: { Region region = Region.EU_WEST_1;

stackoverflow.com

 

 

s3 object docs

https://docs.aws.amazon.com/ko_kr/sdk-for-java/latest/developer-guide/examples-s3-objects.html

 

작업Amazon S3사물 - AWS SDK for Java

이 페이지에 작업이 필요하다는 점을 알려 주셔서 감사합니다. 실망시켜 드려 죄송합니다. 잠깐 시간을 내어 설명서를 향상시킬 수 있는 방법에 대해 말씀해 주십시오.

docs.aws.amazon.com

 

반응형

댓글