Fork me on GitHub
#aws
<
2022-09-22
>
Joshua Suskalo17:09:31

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.

Drew Verlee18:09:06

like making a bucket public?

Joshua Suskalo18:09:59

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.

Drew Verlee18:09:04

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)}}

Joshua Suskalo18:09:50

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?

Joshua Suskalo19:09:19

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

Drew Verlee19:09:07

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

viesti19:09:28

> 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 🙂

Drew Verlee19:09:11

I forget, but you might need to do both.

Joshua Suskalo19:09:26

the single object is actually what I have to mess with

viesti19:09:17

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

Drew Verlee19:09:35

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
viesti19:09:26

This could be the source in the https://github.com/aws/aws-sdk-js/blob/master/apis/s3-2006-03-01.normal.json#L9412-L9417 from where that ACL key is picked up

viesti19:09:20

> 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