HackMD/docs/guides/s3-image-upload.md
2016-11-16 14:27:18 +08:00

1.6 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/*"
        }
    ]
}
  1. Go to IAM console and create a new IAM user. Remember your user credentials(key/access token)

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

    iam-user

  3. Select Custom Policy

    custom-policy

  4. 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/*"
            ]
        }
    ]
}