Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Java SDK requiring bucket-owner-full-control?

I'm pushing files to an S3 bucket and the bucket owner cannot see the files while my role is granted access to write to the bucket. I'm not sure why this is and was hoping I would have to programatically force bucket-owner-full-control.

Simple Code Blob:

      ObjectMetadata metadata = constructMetadata();
      PutObjectRequest request = new PutObjectRequest(bucketName, filename, data, metadata);
      s3Supplier.get().putObject(request);

It uploads successfully, but not seen by the bucket owner. Any reason as to why this would be?

like image 722
Ryan Avatar asked Mar 20 '20 16:03

Ryan


People also ask

What does bucket-owner-full-control do?

When the bucket-owner-full-control ACL is added, the bucket owner has full control over any new objects that are written by other accounts. If the object writer doesn't specify permissions for the destination account at an object ACL level, then the destination account can only delete objects.

Who is the bucket owner in AWS?

By default, when another AWS account uploads an object to your S3 bucket, that account (the object writer) owns the object, has access to it, and can grant other users access to it through ACLs. You can use Object Ownership to change this default behavior.

Why can't I access an object that was uploaded to my Amazon S3 bucket by another AWS account?

For these existing buckets, an object owner had to explicitly grant permissions to an object (by attaching an access control list). Otherwise, the bucket owner would be unable to access the object. With S3 Object Ownership, bucket owners can now manage the ownership of any objects uploaded to their buckets.


1 Answers

PutObjectRequest request = new PutObjectRequest(bucketName, filename, data, metadata).withCannedAcl(CannedAccessControlList.BucketOwnerFullControl);

Inspired by answer

like image 85
Viktor Chernov Avatar answered Oct 22 '22 03:10

Viktor Chernov