How To: Store WordPress Images on Amazon S3

I’ve integrated Amazon S3 with the very handy (and open source) S3 Uploads WordPress plugin, which automatically uploads files to S3 and rewrites URLs from your website to serve them from there.

Step 1: Install WordPress CLI

  • Connect via the terminal access on your server
  • Install the WordPress CLI (if not already installed):
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
sudo chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp

Step 2: Install S3-Uploads WordPress Plugin

  • Download the S3-Uploads WordPress plugin and place it in your wp-content/plugins folder:
wget https://github.com/humanmade/S3-Uploads/archive/master.zip
unzip master.zip
mv S3-Uploads-master/ /wp-content/plugins/S3-Uploads

Step 3: Activate S3 Uploads

  • Now activate the plugin via the WordPress CLI:
wp plugin activate S3-Uploads
  • In order for the plugin to work, you need to store appropriate Amazon Credentials in your config file. In the Amazon Console, add a new IAM user with only access to control your S3 bucket. Then place the credentials and S3 bucket details in your wp-config.php file:
define( 'S3_UPLOADS_BUCKET', 'blog.evandavey.com' );
define( 'S3_UPLOADS_KEY', 'xxxxxxxxxxxxx' );
define( 'S3_UPLOADS_SECRET', 'xxxxxxxxxxxxx' );
define( 'S3_UPLOADS_REGION', 'ap-southeast-2' );
define( 'S3_UPLOADS_BUCKET_URL', 'https://s3-ap-southeast-2.amazonaws.com/blog.evandavey.com' );
  • You’re now all set! All new files uploaded will be automatically copied to S3, and their URL rewritten to that endpoint

Step 4: Sync existing files to S3 (Optional)

  • If you have an existing site, you may wish to migrate all your files up to S3. To do this:
wp s3-uploads verify
wp s3-uploads --sync upload-directory wp-content/uploads/ s3://uploads/

Note: There is currently a bug in the S3-Uploads plugin which causes an error when you run the above:

Fatal error: Class 'Aws\S3\Sync\UploadSyncBuilder' not found

To fix this:

vim wp-content/plugins/S3-Uploads/inc/class-s3-uploads-uploadsyncbuilder.php

And remove reference “extends Aws\S3\Sync\UploadSyncBuilder”

Free SSL Certificates that Automatically Renew with CertBot and LetsEncrypt


It’s been a while since I wrote a blog post (over 5 years!) and in republishing my blog, I wanted to ensure a few best-practices were in place.  One of those is ensuring that all content is served up over HTTPS.

Thankfully, we’ve come a long way in the past 5 years when it comes to providing a simple and cost free way to serve content using HTTPS – with thanks to the CA LetsEncrypt, you can now generate free SSL certificates with ease:

  1. Step 1: Head over to the CertBot from EFF
  2. Select your OS and web server
  3. Follow the step-by-step guide to install CertBot
  4. Bam!  You’re running under HTTPS

Because Certificates from LetsEncrypt are only valid for 90 days, you need to setup a cronjob to renew the certificate.  I do this on a weekly basis as follows:

letsencrypt renew --post-hook "service apache2 reload"

How To: Install SVN on Mac

If you’ve open the terminal and run the “svn” command just to be told “-bash: svn: command not found” then do the following:

1) Install XCode
2) Open “Preferences” and click the “Accounts tab”
3) Add your Apple ID
4) Open the “Downloads” tab
5) Click the download link next to “Command Line Tools”
6) You  have SVN!

XCode Downloads

How-To: Preview Signature is Sideways

Preview IconThe signature function in Mac OSX Preview is awesome. Easy to use, easy to generate, its a great way to “digitally” sign documents. However there is a problem when people send you portrait documents that have been saved in landscape. When you try to sign them, the signature appears sideways!

Here’s how to solve it:
1) Open the PDF is Preview
2) Choose “File -> Print” from the Menu
3) Save as “PDF”:

Save as PDF4) Close the document
5) Open the newly created PDF
6) Choose the signature option – and it will appear the right way up!

Russell Spence Photography

I’ve recently got into amateur photography, picking myself up a Canon 550D digital SLR and snapping away on a variety of trips over the past few months.  In that light, Russell Spence has just launched his photography website, which includes some great landscape and nature shots. You can check out the full collection at russellspence.net

Two Bulls

Our very good friends at Two Bulls have just launched their new website at two-bulls.com.  The striking design is appropriate given they specialise in “immersive” mobile applications.  Checkout their multi-award winning app The Hidden Park for an example.

Currently with offices in Melbourne and New York, Two Bulls also provide a range of specialist mobile consulting services to leading global brands and businesses.  They recently relocated their melbourne office, and to celebrate, had a cake made featuring their logo – very cool.

How-to Fix: The application-identifier entitlement is not formatted correctly

A new error has started showing up when submitting iPhone Apps through iTunes Connect:

“The application-identifier entitlement is not formatted correctly; it should contain your 10-character App ID Seed, followed by a dot, followed by your bundle identifier.”

From what I can tell, the way to fix this to create a NEW entitlements file (see my previous post on creating adhoc builds for instructions on how to do this).  Previously we’d only had to create an entitlements file and uncheck “get-task-allow”.

However now it appears you also need to add a new “keychain-access-group” and add an item which includes your App Identifier (get this from the iTunes Provisioning Portal) and your bundle identifier (com.mycompany.bundle_name).

See an example below: