mirror of https://github.com/status-im/codimd.git
2.4 KiB
2.4 KiB
Guide - Setup HackMD S3 image upload
-
Go to AWS S3 console and create a new bucket.
-
Click on bucket, select Properties on the side panel, and find Permission section. Click Edit bucket policy.
-
Enter the following policy, replace
bucket_name
with your bucket name:{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::bucket_name/uploads/*" } ] }
-
Go to IAM console and create a new IAM user. Remember your user credentials(
key
/access token
) -
Enter user page, select Permission tab, look at Inline Policies section, and click Create User Policy
-
Select Custom Policy
-
Enter the following policy, replace
bucket_name
with your bucket name:{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:*" ], "Resource": [ "arn:aws:s3:::bucket_name/uploads/*" ] } ] }
-
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 "bucket": "YOUR_S3_BUCKET_NAME" } } }
-
In additional to edit
config.json
directly, you could also try environment variable.