Open navClose nav

Cloud Media Storage with AWS S3

Forestry supports storing your media in your own AWS S3 bucket.

Linking Your S3 Bucket

https://res.cloudinary.com/forestry-demo/image/fetch/c_limit,dpr_auto,f_auto,q_80,w_640/https://forestry.io/uploads/2019/01/s3-settings.png

AWS S3 Configuration

The S3 configuration can be rather overwhelming if you’re unfamiliar with the service. For our use case it’s safe to keep the defaults unless mentioned otherwise in the guide below.
  1. Sign up for an AWS account
  2. Log into your dashboard and open the Services dropdown in the top bar, then click on the S3 service.
  3. Click on Create Bucket, name it, remember the Bucket name for later and proceed to the Set Permissions step.
  4. In the Set Permissions step make sure to uncheck the following options:
    • Block new public ACLs and uploading public objects
    • Remove public access granted through public ACLs
  5. Review and create your Bucket.
  6. Create User Credentials for the new Bucket. Open Services and select the IAM service.
  7. Navigate to Users and click on Add User.
  8. Grant Programmatic access to create an _access key ID_ and secret access key.
  9. Choose Attach existing policies directly. You’l need to click on Create Policy in the Set Permissions step.
  10. Name and set your permissions for your policy. Below is an example of the minimum permissions necessary for Forestry’s Media Library.

    https://res.cloudinary.com/forestry-demo/image/fetch/c_limit,dpr_auto,f_auto,q_80,w_640/https://forestry.io/uploads/2019/01/policy-settings.png

  11. Set your newly created policy as your user’s permissions and finish the creation of your new user.

    https://res.cloudinary.com/forestry-demo/image/fetch/c_limit,dpr_auto,f_auto,q_80,w_640/https://forestry.io/uploads/2019/01/permissions-new-user.png

  12. Take note of the Access key ID and the Secret access key and navigate to the Media tab on your site’s Settings in Forestry

  13. Select Amazon S3 as a Media Storage Provider and fill in the Bucket, Access Key and Secret. Click on Save Media Settings. You are now connected to your S3 bucket. You can now upload an image in the Media section to test your connection.

https://res.cloudinary.com/forestry-demo/image/fetch/c_limit,dpr_auto,f_auto,q_80,w_640/https://forestry.io/uploads/2019/01/s3-image.png

Currently, Forestry needs to be able to upload public objects to your S3 bucket in order to display them in the media library (see Step 4). We plan to remove this requirement in a future update.

You will want to adjust your paths in the Media section to work with S3.

  • Public Path: You should enter the full URL to your S3 bucket. This will look something like https://{{ REGION }}.amazonaws.com/{{ BUCKET_NAME }}/.
    • AWS REGION format (e.g. s3-us-west-2) is consistent across regions with the exception of the US EAST 1 (North Virginia) region which is simply s3. (full region list)
  • Front Matter Path: Activate the toggle in this section to use a different public path when inserting an image into front matter.

Migrating Existing Media

Currently, we are not able to automatically migrate existing media from a git repo to a user’s AWS S3 Bucket. We recommend logging in to your AWS console, select your Bucket and bulk upload your images there. After the images are in your Bucket, they will also appear in your Media Library in Forestry.

Unfortunately, for the time being, you will need to manually update your front matter to reassign the new images.

Additional Resources

Here we list a few resources that might be helpful for your S3 implementation. Different from dedicated image services (e.g. Cloudinary), S3 needs some additional setup to make eager and lazy image manipulations possible.

Image Manipulation


Last updated on January 8, 2019