hedgedoc/docs/guides/s3-image-upload.md
Sheogorath bd92010dd2
Remove camel case from imageuploadtype in config
This removes the only camel cased option of the config options
**we** added to the config.json.

In auth provider's config parts are a lot of camel cased options
provided. We shouldn't touch them to keep them as similar as
possible to the examples.

Fixes #315

Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
2018-01-27 23:50:15 +01:00

2.4 KiB

Guide - Setup HackMD S3 image upload

  1. Go to AWS S3 console and create a new bucket.

    create-bucket

  2. Click on bucket, select Properties on the side panel, and find Permission section. Click Edit bucket policy.

    bucket-property

  3. Enter the following policy, replace bucket_name with your bucket name:

    bucket-policy-editor

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Principal": "*",
                "Action": "s3:GetObject",
                "Resource": "arn:aws:s3:::bucket_name/uploads/*"
            }
        ]
    }
    
  4. Go to IAM console and create a new IAM user. Remember your user credentials(key/access token)

  5. Enter user page, select Permission tab, look at Inline Policies section, and click Create User Policy

    iam-user

  6. Select Custom Policy

    custom-policy

  7. Enter the following policy, replace bucket_name with your bucket name:

    review-policy

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "s3:*"
                ],
                "Resource": [
                    "arn:aws:s3:::bucket_name/uploads/*"
                ]
            }
        ]
    }
    
  8. Edit config.json and set following keys:

    {
        "production": {
            ...
            "imageuploadtype": "s3",
            "s3": {
                "accessKeyId": "YOUR_S3_ACCESS_KEY_ID",
                "secretAccessKey": "YOUR_S3_ACCESS_KEY",
                "region": "YOUR_S3_REGION" // example: ap-northeast-1
            },
            "s3bucket": "YOUR_S3_BUCKET_NAME"
        }
    }
    
  9. In additional to edit config.json directly, you could also try environment variable.