Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support making the bucket public, in that anyone can download files unauthenticated if they know the URL #42

Closed
simonw opened this issue Dec 7, 2021 · 3 comments
Labels
enhancement New feature or request research
Milestone

Comments

@simonw
Copy link
Owner

simonw commented Dec 7, 2021

This can be considered a subset of:

@simonw simonw added enhancement New feature or request research labels Dec 7, 2021
@simonw
Copy link
Owner Author

simonw commented Dec 7, 2021

As far is I can tell the best way to do this is to attach a bucket policy: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.put_bucket_policy

response = client.put_bucket_policy(
    Bucket="examplebucket",
    Policy='{"Version": "2012-10-17", ... ] } ]}',
)

I think the policy I need is this one (found variants of it in a few different places online):

{
  "Version":"2012-10-17",
  "Statement":[{
      "Sid":"AllowAllGetObject",
      "Effect":"Allow",
      "Principal": "*",
      "Action":["s3:GetObject"],
      "Resource":["arn:aws:s3:::examplebucket/*"
      ]
    }
  ]
}

@simonw
Copy link
Owner Author

simonw commented Dec 7, 2021

I got this working, but the files I upload with s3-credentials put-object all have Content-Type: binary/octet-stream.

@simonw
Copy link
Owner Author

simonw commented Dec 7, 2021

I started with --create-bucket --public-bucket but I'm going to go with --create-bucket --public instead, it seems neater and I think it's clear what it's going to do.

@simonw simonw closed this as completed in 6e0a2c2 Dec 7, 2021
simonw added a commit that referenced this issue Dec 7, 2021
@simonw simonw added this to the 1.0 milestone Jan 17, 2022
simonw added a commit that referenced this issue Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request research
Projects
None yet
Development

No branches or pull requests

1 participant