Amazon S3 comes as a popular object storage service provided by Amazon Web Services. It allows you to store your application or website data with huge file sizes.
Fortunately, it’s possible for you to connect AWS S3 with your WordPress site. And you know what? Storing the Media Library proves the most common usage. It enables you to save any media type, from images, videos, audio to PDF documents.
However, the process of migrating files from WordPress to S3 is not an easy task, unless you have a detailed guide at hand.
Our article today focuses on 4 steps to upload WordPress media to S3. But before digging into the full guide, let’s discuss 3 reasons why you should move your files to S3.
Why Moving WordPress Media to S3
There are numerous benefits of storing files in AWS S3 that make it the most favored storage of all time. Below are some particular ones:
#1 Reduce Server Request
Offloading your images and videos from WordPress into Amazon S3 means that you will serve those files from this storage to visitors, instead of loading them directly from your hosting. This helps reduce requests to your server.
Your server doesn’t have to serve images, CSS, JS, videos, PDFs, zips, and all other files anymore. Since then, it can concentrate on processing PHP and deliver pages to visitors faster.
#2 Spead up Page Loading Time
You might not notice but large images and videos drag down your site speed. And at the same time, visitors have to wait until they’re completely loaded. This definitely frustrates your users and impacts their browsing experience.
Cleaning up your media library by uploading/offloading all files to S3 significantly decreases average page load times.
#3 Boost Your Site Ranking
Google or any search engine considers page load time as an important factor to determine your page and site position on search results. It’s because page speed affects the crawling process.
Storing all your files on AWS S3 speeds up your page loading time which results in better rankings on SERPs. As a result, you can drive more traffic to your site and improve the conversion rate.
How to Offload Media Files from WordPress into S3
Once you understand the reasons for storing your WordPress files in Amazon S3, it’s time to head to the next part of how to achieve that. We recommend the WP Offload Media Lite plugin.
The plugin receives love from over 50 thousand users globally thanks to its diverse features and ease of use. Apart from Amazon S3, it supports uploading media files to DigitalOcean Spaces and Google Cloud Storage.
Here are 4 main steps you must go through to successfully offload images and videos from WordPress to Amazon S3.
Step 1: Install the WP Offload Media Lite Plugin
You firstly need to have the plugin installed and activated before taking any further steps:
- Go to Plugins → Add New in your WordPress admin dashboard
- Type “wp offload media” in the keyword box to search for the plugin
- Install and activate the plugin
Step 2: Set up AWS Account
Once having the WP Offload Media Lite plugin ready on your site, you now need to set up an AWS account.
- Simply log into your AWS account or sign up for a new one if you haven’t registered an account yet.
- Create a new IAM user. Follow our guide on how to add IAM users here. Remember to choose Programmatic for the Access type*.
- Hit the Next Permission button
- Click the “Attach existing policies directly” button then enter “s3” in the filter policies box
- Pick “AmazonS3FullAccess” policy to prevent potential problems when setting up your account for the first time
- Provide tags (optional) then click on the Next: Review → Create User button
As soon as this process finishes, you’ll get Access Key ID and the Secret Access Key. You should save this information as a .csv file for later use.
Step 3: Add Access Keys to wp-config.php File
Adding the access keywords to your wp-config.php file helps secure this important credential info. All you need to do now is log into your cPanel → wp-config.php and paste the following code snippet:
define( 'AS3CF_SETTINGS', serialize( array( 'provider' => 'aws', 'access-key-id' => '********************', 'secret-access-key' => '******************', ) ) );
The code must be placed right before the /* That’s all, stop editing! Happy publishing. */ line there.
You can also find this code on your WordPress Settings page, under the Offload Media section.
Step 4: Create an Amazon S3 Bucket
Transferring newly uploaded WordPress media files to S3 requires you to create buckets to store them. You can skip this step if you already have one. If not, this guide will show you how: How to Create Amazon S3 Bucket and Get User Access Key
Once creating your bucket, head to the plugin Settings page → Media Library tab and enter its name in the Bucket box. Then, save the bucket’s settings.
You’re almost done. All your new media uploads will be store directly in Amazon S3 from now on. In case you plan to move the existing files in the WordPress media library, you must upgrade to its Pro version.
It charges you at least $69 a year for the Bronze license to move 20 thousand offloaded media files from unlimited sites.
Step 5: Configure WP Offload Media Lite Settings
This image gives you a clear picture of the default WP Offload Media Lite plugin settings. However, you should adjust some options to best use the plugin.
You should enable to Force HTTPS option if your site is HTTPS encrypted. You can also put the Remove Files From Server feature in the ON status to manage your disk space usage.
Ready to Offload WordPress Media to AWS S3?
It’s of significance to offload your media files from WordPress to Amazon S3 for a couple of reasons. It assists you in reducing the server request which helps improve the page loading time and boost site ranking.
We’ve walked you through the full guide on how to move your newly uploaded WordPress images or videos to S3. Noticeably, you must pay for WP Offload Media Pro to shift the entire Media Libary there.
Still have any difficulty in how to offload WordPress images, videos, and audios to AWS S3? Share your concern in the comment box below.