with amazon s3 sdk, i tried creating a bucket but ...
# box-products
g
with amazon s3 sdk, i tried creating a bucket but the bucket is getting created with this access: Bucket and objects not public here is my code for crreating it
Copy code
any function CreateBucket(required ID="", required location="USA",secureSection="0") {
		var messages = [];
		var bucket_Name = arguments.secureSection eq 1 ? 's3-'&lcase(arguments.clientID)&'-secure' : 's3-'&lcase(arguments.clientID)&'-files';
		var checkBucket = hasBucket(bucket_Name);
		var loc = getLocations(arguments.location);
		if (!checkBucket ) {
			createBucket = putBucket(bucketName=bucket_Name,location=loc);
			if (createBucket ) {
				arrayAppend(messages, 'Bucket Created Successsfully');
			}
		}
		setAWSRegion(loc);
		return messages;
	}
j
That is AWS’s default bucket ACL behavior. You will need to use the
acl
argument to
putBucket
if you want bucket objects to be public.
Actually it looks like
public-read
is the default ACL used in S3SDK. We may need to look at what additional headers are necessary to override the AWS defaults.
@bdw429s Any thoughts?
b
I would view the bucket in the AWS console to see what permissions its getting created as
Also, he may have changed the S3SDK's default ACL
g
I did not changed default ACL
b
AWS recently changed the default behavior when creating new buckets to make it so all new buckets have all public access blocked.
j
We will probably need to add, in the SDK, an additional API call when creating a bucket to prevent the default access behavior. https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutPublicAccessBlock.html#API_PutPublicAccessBlock_RequestSyntax In the short term, @gsr you can go in to the AWS console and modify the bucket settings for “Block Public Access”