반응형
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/
CannedAccessControlList 공식문서
.acl(ObjectCannedACL.PUBLIC_READ)
put object
java - Upload a file to AWS S3 with public access granted - Stack Overflow
s3 object docs
https://docs.aws.amazon.com/ko_kr/sdk-for-java/latest/developer-guide/examples-s3-objects.html
반응형
'CLOUD > AWS' 카테고리의 다른 글
AWS kinesis data firehose 개념 및 간단한 샘플,실습 (0) | 2022.11.01 |
---|---|
AWS S3를 route 53으로 도메인 연결하기 (0) | 2022.10.28 |
AWS ECR 400 Bad Request 에러, 인증에러 (windows,powershell) (0) | 2022.10.20 |
[AWS SDK] InstanceProfileCredentialsProvider deprecated(사용만료) 로 인한 EC2ContainerCredentialsProviderWrapper사용 (0) | 2022.10.19 |
AWS 예약된 ip 주소 (0) | 2022.10.18 |
댓글