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
.
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?
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.
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.
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.
PutObjectRequest request = new PutObjectRequest(bucketName, filename, data, metadata).withCannedAcl(CannedAccessControlList.BucketOwnerFullControl);
Inspired by answer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With