How to define permissions in Amazon s3 -
I have a structure on Amazon like this -
(name of bucket) MyImages - - (key) Normal ---- 1.jpg ---- 2.jpg
I have created key (normal) using the S3 Firefox Organizer tool and for all Set the read permission. Now, when I am uploading images inside this key by the Java program, I want to set the value of each object as a key. But this is not happening and I need to write some additional line code to allow each object.
AccessControlList acl = s3.getBucketAcl ("MyImages"); // read everybody using ACL Grant Promotion (Group Granty. ALUURES, Perm., Reid); S3.setObjectAcl ("MyImages", "Normal / 1.jpg", ACL);
Is there any way to get rid of the above code? Why not get permission for objects or keys?
The following code works for me Change file_to_save with the file object that you are writing to S3 Are there.
PutObjectRequest por = New PutObjectRequest ("MyImages", "general / 1.jpg", file_to_save); O.setCannedAcl (CannedAccessControlList.PublicRead);
Comments
Post a Comment