
Yesterday I setup automatic file upload
and backup upload
to Amazon AWS S3
. During setup I faced number of issues.
Current documentation on Discourse Meta site is not up-to-date. It’s with old setup steps and user may easily get confused with new updated AWS console UI changes.
Here is our Crunchify Forum: https://ask.crunchify.com. Between head over to tutorial Setting up Discourse on Linode correct way if you want to start your own forum 🙂
During setup, I faced below two issues:
Issue-1
[2016-12-15 04:01:13] EXCEPTION: unable to sign request without credentials set [2016-12-15 04:01:13] /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/aws-sdk-core-2.5.3/lib/aws-sdk-core/plugins/request_signer.rb:100:in `require_credentials' ... ... /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/unicorn-5.2.0/lib/unicorn/http_server.rb:508:in `spawn_missing_workers' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/unicorn-5.2.0/lib/unicorn/http_server.rb:132:in `start' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/unicorn-5.2.0/bin/unicorn:126:in `<top (required)>' /var/www/discourse/vendor/bundle/ruby/2.3.0/bin/unicorn:23:in `load' ... ...
This got resolved by unchecking box
for use iam profile
(check diagram below).
Issue-2
[2016-12-15 18:17:43] EXCEPTION: Access Denied [2016-12-15 18:17:43] /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/aws-sdk-core-2.5.3/lib/seahorse/client/plugins/raise_response_errors.rb:15:in `call' ... ... /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/unicorn-5.2.0/bin/unicorn:126:in `<top (required)>' /var/www/discourse/vendor/bundle/ruby/2.3.0/bin/unicorn:22:in `load' /var/www/discourse/vendor/bundle/ruby/2.3.0/bin/unicorn:22:in `<main>' [2016-12-15 18:17:43] Notifying 'crunchify' of the end of the backup... ... ...
This got resolved by correcting bucket name. Make sure to provide same bucket name for backup folder too (check diagram below).
This tutorial will help you setup Amazon S3 right way for your Discourse Forum including if you have any of below questions.
- Setting up Discourse on AWS
- A better Discourse backup to Amazon S3
- Setting up file and image uploads to AWS S3
- Connect Amazon S3 to Discourse Integration
- Setting up file and image uploads to S3
Let’s get Started:
Step-1
- Go to
Amazon AWS S3
using link:https://aws.amazon.com/s3/
- Register for it. Provide credit card and right shipping address to complete setup
- By default, Amazon Free tier comes with
12 months of free access
Step-2
- Go to AWS Management Console using link:
https://us-west-2.console.aws.amazon.com/console/home?region=us-west-2
- Search for
IAM
in search box

Step-3
- From left side panel click on
Policies
- Click on
Create Policy
Button - Click on
Select
button next toCreate Your Own Policy
- Provide Name
crunchify-com-discourse
, Description and Document

Policy Document:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "s3:*", "Resource": [ "arn:aws:s3:::crunchify-com-s3", "arn:aws:s3:::crunchify-com-s3/*" ] } ] }
NOTE:
Please make sure to change bucket name from crunchify-com-s3
to your own preferred name.
Step-4
- Now from left panel click on
Users
link - Click on
Add User
- Provide
User name
- Click
Programmatic access
checkbox forAccess type

- Next screen click on
Attach existing policies directly
- Select
crunchify-com-discourse
from list of policy - On Next Screen, click on
Create User
- You will be given
Access key ID
andSecret access key
which you need to provide into Discourse Setting page

Step-5
- Now go to Amazon S3:
https://console.aws.amazon.com/s3/home?region=us-west-2
- Click on
Create Bucket
button - Provide bucket name
crunchify-com-s3
. This should match with Policy document bucket name - Select region
Oregon
and clickCreate

Step-6
- Go to
Files
section of your forum Admin Setting page:admin/site_settings/category/files
- Provide all detailed values as you see in below screenshot
- Check checkbox for
enable s3 uploads
- Don’t check checkbox for
s3 use iam profile
- Provide S3 access key id, secret access key, region and upload bucket

Step-7
- Go to Backups tab here:
admin/site_settings/category/backups
- Click checkbox for
enable s3 backups
- Provide bucket name as you created above

And you should be all set. You are done with your setup. Take a break if you need as we need to test and debug our setup next.
Let’s get started on verification
Step-1 – file upload
Try uploading new image to your post and you should see it should be updated to your AWS S3.

Step-2 – backup .zip file upload
Try running backup manually and you should see file should be uploaded to AWS S3 folder too 🙂

Let me know if you have any question about the same.