aws 2022-09-22

Are there any examples of using aws-api with s3 access control lists? Looking at the javadocs for the java api it's unclear to me if aws-api would manage to have a data representation of those parts of the api.

like making a bucket public?

Well my usecase is assigning a grant to a specific user on specific objects as I create them in the bucket, but just any example of using ACL stuff would satisfy me.

I think granting a user access to a bucket would be done through IAM and would reference the bucket. here is an example of some code that uses the s3 aws-api to make a bucket public:

{:op :PutObject :request {:Bucket bucket  :Key (str stack-name "/" to-file)
                                                                  :ACL "public-read"
                                                                  :Body (io/input-stream from-file)}}

the use of :ACL there surprises me since the Java SDK has that property as :AccessControlList. Where in the docs should I be looking for this sort of thing? Do I need to be finding aws' http docs or something?

Ok, cool, that's what I'd wanted to know about, that I have to match the http api, not the java sdk

The aws api has a doc function you can call on putobject to get more information.

> here is an example of some code that uses the s3 aws-api to make a bucket public: Had to nit a bit 😄 , that set's the ACL for a single object to be public, not the whole bucket 🙂 But a very great example indeed, just the right example indeed 🙂

I forget, but you might need to do both.

the single object is actually what I have to mess with

yup, though there is also this https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-block-public-access.html, so if that is turned on, then those single object ACLs might not apply

The aws-api repo has s3 examples that will give you a good idea of how to work with it in general. The rest is on aws to explain.

👍 1

> The aws api has a doc function you can call on putobject to get more information. > That is probably best source for docs, there are actually links to aws rest apis even I think