How to move WordPress images to Amazon S3 – Free Solution!

Web administrators transitioning the existing WordPress sites (and image resources) to Amazon S3 have couple of paid plugins to choose from to ease the move to S3. However, most of the WordPress plugins come at a pretty hefty prices, some as high as couple of hundred dollars. The following guide outlines the step by step option that is completely free of charge.

Video Guide

 

Step by Step Guide:

1. SETUP AMAZON S3 BUCKET

First of all, login to Amazon S3: https://console.aws.amazon.com/s3/ and create a new bucket for your WordPress images, you can call it whatever you wish, just choose the name that’s available and note that caps are not allowed when naming  S3 buckets). So, something like this:

Leave the permissions like this (logging is options, but you may want to know the details of how your images are being accessed):

As far as permissions, leave the reading of images open to everyone:

The bucket review should look like this:

Go to Amazon and get your ‘Access Key ID’ and ‘Secret Access Key’ for the Amazon AWS account in question.

 

 

 

2. INSTALL AND CONFIGURE ‘AMAZON WEB SERVICES’ PLUGIN

Now, login to your WordPress, then under Plugins, install ‘Amazon Web Services‘ Plugin:

Once installed, activate the plugin and click on the access keys option:

Now you have an option of defining your Amazon S3 access keys in wp-config.php or through the form.

If you want to do this through wp-config.php, simply copy the following snippet into wp-config.php and replace the stars with the keys:

define( ‘DBI_AWS_ACCESS_KEY_ID’, ‘********************’ );
define( ‘DBI_AWS_SECRET_ACCESS_KEY’, ‘****************************************’ );

Otherwise click on ‘store your Access Keys in the database’, there is an option to click here to reveal a form, right at the bottom of the screen:

Enter your Amazon Access Key ID and Secret Access Key:

 

 

 

3. INSTALL AND CONFIGURE ‘WP OFFLOAD S3 LITE’ PLUGIN

Now, that the AWS account and plugin is all setup, we’ll need to download and configure another WordPress plugin.

Go to Plugins, Add New and search for ‘WP Offload S3 Lite‘ WordPress plugin, it should look like this:

Once installed and activated, simply go to its settings:

Then select option to ‘Browse Existing Buckets’:

and select the bucket you’ve created earlier, in my case it looked like this:

Once selected, configure the options as follows:

With above setting, all new images uploaded to your WordPress will automatically be moved to Amazon S3, removed from your local server and served from Amazon S3.

If you do not wish the images to be deleted from your local server, turn off the option ‘Remove Files From Server.’

 

 

 

 

4. INSTALL AND CONFIGURE ‘REGENERATE THUMBNAILS’ PLUGIN

If you also wish to move all of your existing WordPress images to Amazon S3, you can purchase ‘WP Offload S3’ WordPress plugin full version, which offers that option as a paid upgrade.

However, you will also be able to do this for free, if you regenerate your images, which essentially tricks WP Offload S3 Lite into thinking that the existing images are brand new uploads.

To do so, go to Plugins, Add New and search for ‘Regenerate Thumbnails‘ WordPress plugin, it should look like this:

Install and activate it.

Then go to Tools, Regenerate Thumbnails and press the button: ‘Regenerate All Thumbnails’:

All your images will be moved to Amazon S3. Depending on the number of files, it may take a long time to process:

Depending on the upload bandwidth available to your server and the total number of images, all your image resources will be uploaded to Amazon and removed from your local server.

For one of my smaller sites, resizing, and moving 586 images to Amazon S3, took approximately 1,429 seconds, or 2.43 seconds for each image on average. That’s about 40 minutes per 1,000 images:

 

 

5. TEST THE RESULTS

To test the results, simply right click on any of the images uploaded to your website and you’ll find that its URL points to Amazon S3 now.

For example, the image stored at this address of your WordPress site:

/wp/wp-content/uploads/2017/03/fast-track-to-mortgage-freedom-w-1.jpg

, will be stored in the following bucket address now:

http://s3.amazonaws.com/wordpress-imgs/wp/wp-content/uploads/2017/03/13002252/fast-track-to-mortgage-freedom-w-1.jpg

 

 

AMAZON S3 VALUE

At the current prices, 500gb worth of images stored in Amazon S3, would come at the cost of approximately 11.42 USD:

To move your sites images to S3 is not only more economical than hosting them on your dedicated server, where cost of storage is much more expensive, but moving images out of your web server and additional pairing with Amazon CDN, will also make your site much faster to your customers.

Enjoy!

Comments

comments