Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.


Utilising Amazon S3 to supercharge your SilverStripe Hosting

Scaling your hosting on the fly has never been easier. Chief Architect at Moosylvania, Joe Madden, explains Flysystem and the SilverStripe S3 module, offering agencies more flexibility to host on new platforms and maintain high performance.

Read post

At Moosylvania, an independent brand building agency from St. Louis, Missouri, we’re devoted to building passionate brand communities. We have clients of all sizes that require extremely performant and highly available websites that are also cost effective. This requires us to be flexible with who our hosting providers are as well as the ability to scale our hosting at a moment’s notice. With SilverStripe 4.x, we now have a great solution that provides modularity to how its static file assets are hosted and which allows us to host on almost any platform.

Amazon S3 (AWS Simple Storage Service) is a distributed file system provided by Amazon on their AWS platform that is stated to be a “highly durable and available store”. The benefits of storing assets on S3 include the possibility of data redundancy for backups and disaster recovery, increased network performance and uptime, as well as the ability to distribute assets across various content delivery networks for faster download speeds for your users.

As an agency, our client’s sites vary greatly in size. Some sites receive a relatively small volume of traffic (5-10k visitors per month) and some have over 1,000 times that. The ability to scale hosting on the fly has been a difficult thing in the past. But with SilverStripe 4.x and their migration to using Flysystem for their static file storage backend, the task of horizontally scaling your hosting is now much easier.

Flysystem is a filesystem abstraction that provides a generic API allowing you to swap from using your local filesystem storage to a distributed filesystem like Amazon S3, Google Cloud Storage, Digital Ocean, Rackspace, and many others (through Flysystem’s adapters). This means that all static assets uploaded from the CMS will now be stored on S3 instead of your servers filesystem.

Additionally, if you’re utilising a hosting provider that only provides an ephemeral-based filesystem like Heroku or Google App Engine, or if you’re utilising containers such as Docker to house your application code, you need a place to store your uploaded assets that is separated from your site and code repositories. Flysystem makes this much easier (check the Twelve-Factor App for more theory behind this).

This leads us to the SilverStripe S3 module. This module provides a wrapper for Flysystem, utilising their S3 Adapter to tell SilverStripe to upload files directly to S3. We've had a great experience with the S3 module and the only difficulty is signing up for an Amazon AWS account, creating your first bucket, and securing it properly.

The S3 module README provides an example policy which will help you secure your S3 bucket. There are also services to create and manage your S3 bucket’s security for you, such as Bucketeer and Cloudcube. With this module, our agency can now host on a platform like Heroku, where we don’t have to worry about security updates of the server’s OS and all the other tasks that go with managing physical or virtual servers.

Additionally, when a client has a planned promotion and is expecting a huge spike in traffic, we can simply scale up our hosting horizontally with as many server instances as required, and we know that any of the uploaded assets will be accessible directly from Amazon. To check that sessions are working across the multiple instances, we can either see if our hosting provider offers some sort of “sticky session” or “session affinity” layer which ensures a user’s session always gets directed to the same server, or utilise a shared database like memcached, Redis, or SilverStripe’s DynamoDB module for storing our sessions.

A final benefit of having our assets stored in S3 is that we can utilise a CDN like Amazon Cloudfront to distribute those assets to their global edge networks more easily. We can also utilise image processing providers like Cloudinary to access and store directly to our S3 bucket optimised, uploaded image assets for our site’s frontend to increase overall performance (see MadeHQ/silverstripe-cloudinary for CMS support).

Keen to try it for yourself?

Check out the SilverStripe S3 module.

Want to get involved in the SilverStripe community?

Get acquainted with the SilverStripe developer community on Slack.

About the author
Joe Madden

Joe is Chief Architect at Moosylvania, an independent brand building agency from St. Louis, Missouri, devoted to building passionate brand communities.

Post your comment


  • Thanks for looking after (and caring about) the module Joe! It’s great to see the community coming together to support this!

    Posted by Matt, 25/04/2019 9:39am (5 years ago)

RSS feed for comments on this page | RSS feed for all comments