aboutsummaryrefslogtreecommitdiff
path: root/doc/tips/publishing_your_files_to_the_public.mdwn
diff options
context:
space:
mode:
Diffstat (limited to 'doc/tips/publishing_your_files_to_the_public.mdwn')
-rw-r--r--doc/tips/publishing_your_files_to_the_public.mdwn54
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.