How to mark a certain S3 file as Make Public via the webservices API.
Select the group that you just created, e.g. S3OneFS , and click “Group Actions”. Select “Add Users to Group”. Then, select your user, e.g. ObjectiveFS , and click “Add Users”. You can now use your “Access Key ID” and “Secret Access Key” to run ObjectiveFS restricted to a single bucket.
First select a bucket and click the Properties option within the Actions drop down box. Now select the Permissions tab of the Properties panel. Verify that there is no grant for Everyone or Authenticated Users. If one or both exist, remove the Everyone and Authenticated Users grantees.
Steps to allow public access to private AWS S3 bucket files: Click on the private S3 bucket with the object that you want to make public. Click on the Permissions tab. Click Edit on the Block public access section. Click on the Block all public access to uncheck and disable the options.
To allow users to perform S3 actions on the bucket from the VPC endpoints or IP addresses, you must explicitly allow the user-level permissions. You can explicitly allow user-level permissions on either an AWS Identity and Access Management (IAM) policy or another statement in the bucket policy.
Use method setCannedAcl(CannedAccessControlList.PublicRead)
to change Access control rights. Read java doc for details here
Sample Code:
BasicAWSCredentials basicAWSCredentials = new BasicAWSCredentials(ACCESS_KEY,SECRET_KEY);
AmazonS3 s3 = new AmazonS3Client(basicAWSCredentials);
PutObjectRequest putObj = new PutObjectRequest(bucketName, objectKey, fileToUpload);
// making the object Public
putObj.setCannedAcl(CannedAccessControlList.PublicRead);
s3.putObject(putObj);
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