How to check if aws s3 bucket is writable or not

Given a bucket name, aws key, aws secret, and region, how can I tell if bucket is writable or not.
I am using this this library https://github.com/ex-aws/ex_aws.

I have read aws s3 docs, but struggling to find the proper solution. Is there a simple way to check this.

In addition to ex_aws, you’ll also need ex_aws_s3. Then you should be able to do something like

"foo_bucket"
|> ExAws.S3.get_bucket_acl() 
|> ExAws.request!()

That should return a mapping that represents the Access Control List (ACL) of the bucket (described here).

I’m not in a position to test this at the moment, but this is the basic pattern used in the (lovely) ex_aws libraries.

2 Likes