diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-06-05 14:38:01 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-06-05 14:38:01 -0400 |
commit | e9ab4e21fd215048e63f37d458e69f3f848ed5cb (patch) | |
tree | a3411387e53b8b45c4e92232b66b004243846dbc /doc/tips/publishing_your_files_to_the_public.mdwn | |
parent | 88898179b355ea80d5afa6ede9b931c6d5e84144 (diff) |
public=yes config to send AclPublicRead
In my tests, this has to be set when uploading a file to the bucket
and then the file can be accessed using the bucketname.s3.amazonaws.com
url.
Setting it when creating the bucket didn't seem to make the whole bucket
public, or allow accessing files stored in it. But I have gone ahead and
also sent it when creating the bucket just in case that is needed in some
case.
Diffstat (limited to 'doc/tips/publishing_your_files_to_the_public.mdwn')
-rw-r--r-- | doc/tips/publishing_your_files_to_the_public.mdwn | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/doc/tips/publishing_your_files_to_the_public.mdwn b/doc/tips/publishing_your_files_to_the_public.mdwn index d2c074503..50fb64db3 100644 --- a/doc/tips/publishing_your_files_to_the_public.mdwn +++ b/doc/tips/publishing_your_files_to_the_public.mdwn @@ -2,28 +2,19 @@ (In this example, I'll assume you'll be creating a bucket in S3 named **public-annex** and a special remote in git-annex, which will store its files in the previous bucket, named **public-s3**, but change these names if you are going to do the thing for real) -First, in the AWS dashboard, go to (or create) the bucket you will use at S3 and add a public get policy to it: +Set up your special [S3](http://git-annex.branchable.com/special_remotes/S3/) remote with (at least) these options: - { - "Version": "2008-10-17", - "Statement": [ - { - "Sid": "AllowPublicRead", - "Effect": "Allow", - "Principal": { - "AWS": "*" - }, - "Action": "s3:GetObject", - "Resource": "arn:aws:s3:::public-annex/*" - } - ] - } - -Then set up your special [S3](http://git-annex.branchable.com/special_remotes/S3/) remote with (at least) these options: + git annex initremote public-s3 type=s3 encryption=none bucket=public-annex chunk=0 public=yes - git annex initremote public-s3 type=s3 encryption=none bucket=public-annex chunk=0 +This way git-annex will upload the files to this repo, (when you call `git +annex copy [FILES...] --to public-s3`) without encrypting them and without +chunking them. And, thanks to the public=yes, they will be +accessible by anyone with the link. -This way git-annex will upload the files to this repo, (when you call `git annex copy [FILES...] --to public-s3`) without encrypting them and without chunking them, and, because of the policy of the bucket, they will be accessible by anyone with the link. +(Note that public=yes was added in git-annex version 5.20150605. +If you have an older version, it will be silently ignored, and you +will instead need to use the AWS dashboard to configure a public get policy +for the bucket.) Following the example, the files will be accessible at `http://public-annex.s3.amazonaws.com/KEY` where `KEY` is the file key created by git-annex and which you can discover running @@ -31,8 +22,6 @@ Following the example, the files will be accessible at `http://public-annex.s3.a This way you can share a link to each file you have at your S3 remote. -___________________ - ## Sharing all links in a folder To share all the links in a given folder, for example, you can go to that folder and run (this is an example with the _fish_ shell, but I'm sure you can do the same in _bash_, I just don't know exactly): @@ -74,3 +63,26 @@ done | git annex registerurl </pre> `registerurl` was introduced in `5.20150317`. There's a todo open to ensure we don't have to do this by hand: [[todo/credentials-less access to s3]]. + +## Manually configuring a public get policy + +Here is how to manually configure a public get policy +for a bucket, in the AWS dashboard. + + { + "Version": "2008-10-17", + "Statement": [ + { + "Sid": "AllowPublicRead", + "Effect": "Allow", + "Principal": { + "AWS": "*" + }, + "Action": "s3:GetObject", + "Resource": "arn:aws:s3:::public-annex/*" + } + ] + } + +This should not be necessary if using a new enough version +of git-annex, which can instead be configured with public=yet. |