In this tutorial, we are going to walk you through how to complete a WordPress Amazon S3 integration as well as optionally using a content delivery network (CDN) alongside it. This can dramatically save you on bandwidth costs, act as a backup, and help speed up your site.

wordpress amazon s3

Amazon S3 is a storage solution, and part of Amazon Web Services many products. It is very similar to a web host, but generally offers less expensive bandwidth and storage. Typically this is used for large sites that either need additional backups or are serving up large files (downloads, software, videos, games). Amazon has a proven track record of being very reliable, and because of their massive infrastructure they are able to offer very low storage costs. Some of S3’s customers include Netflix, airbnb, SmugMug, Nasdaq, etc.

Amazon S3 is not to be confused with Amazon CloudFront. CloudFront is a CDN solution, where as S3 is a storage solution. However, they can both be used interchangeably as we’ll get into more below.

WordPress Amazon S3 Setup

For this integration we recommend using the WP Offload S3 Lite plugin, developed by the awesome team over at Delicious Brains. The basic version is free. The plugin copies files from your WordPress site to Amazon S3 automatically as they are uploaded to the media library. There is than an optional configuration for adding a CDN, such as Amazon CloudFront, KeyCDN, or MaxCDN.

wp offload s3 lite

This plugin is pretty lightweight, only 204 KB to be exact. As of writing this, it currently has over 20,000 active installs with a 4 out of 5 star rating. However, to use the above plugin you must have the Amazon Web Services plugin installed first. This is also developed by Delicious Brains. Follow the steps below.

Step 1

To install the free Amazon Web Services plugin, you can download it from the WordPress repository or by searching for “Amazon Web Services” within your WordPress dashboard under “Add New” plugins. Click on “Install Now” and activate it.

amazon web services plugin

Step 2

Next, install the free WP Offload S3 Lite plugin. You can download it from the WordPress repository or by searching for “wp offload s3” within your WordPress dashboard under “Add New” plugins. Click on “Install Now” and activate it.

install wp offload s3 lite

Step 3

You can follow the WordPress Amazon S3 documentation from Delicious Brains or we will walk you through the rest in more depth.  Login to your Amazon Web Services account. If you don’t have one you can sign up for free. You will then need to create a new user. Choose a user name and make sure you select “Programmatic access.”

amazon web services add user

Step 4

Now you need to setup permissions for the user to manage files in S3, so select “Attach existing policies directly” and click on “Create policy.” This will open in a new window. Once you are done you will need to come back to this.

permissions awsStep 5

Click “Select” next to the create your own policy option.

create policy aws

Step 6

Next you will need to give your policy a name and description. This can be whatever you want. Then copy the following code into the “Policy Document” section.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:CreateBucket",
        "s3:DeleteObject",
        "s3:Put*",
        "s3:Get*",
        "s3:List*"
      ],
      "Resource": [
        "arn:aws:s3:::*"
      ]
    }
  ]
}

According to Delicious Brain’s documentation. This policy allows the user to create buckets, delete files only (not buckets), upload files, download files, and list files and buckets. This is the basic level of permissions the plugins require to function. Then click on “Create Policy.”

review policy aws

Step 7

Returning to the window from Step 4, you now need to add the policy to the user you are creating. Click on “Refresh” and you should see your new policy you just created at the top. Select that and click on “Next.”

aws permissions user

Step 8

Then click on “Create user.”

aws create user

Step 9

On the last screen you will need to copy down your access key ID and secret access key to a safe place as you will need this for back in your WordPress dashboard.

aws access key

Step 10

Then back in WordPress click into “Access Keys” under AWS and input your credentials that you just created. Or, as Delicious Brains recommends, it is better to define them in your wp-config.php file. Simply copy the following snippet and replace the stars with the keys.

define( 'DBI_AWS_ACCESS_KEY_ID', '********************' );
define( 'DBI_AWS_SECRET_ACCESS_KEY', '****************************************' );

hookup amazon web services wordpress

Step 11

You must then create a bucket to use. If you are not signed up yet with Amazon S3, you can signup here. They have a free trial you can get started with. Click into “S3 and CloudFront” under the AWS plugin settings and click “Create bucket.” You can then choose a region. Click on “Create New Bucket.” Remember that storage costs vary per region. See prices.

create amazon s3 bucket

Step 12

To get WP Offload S3 to work with certain 3rd party plugins such as WooCommerce, you might need to install and activate some of their compatibility addons. And this sometimes requires paying for their premium license. However there are a lot of times you can get by with the free version as well. By default the following options as seen below are checked. if you are running over HTTPS you will want to enable that.

aws plugin settings

Your WordPress Amazon S3 setup is now complete! Your images will now be copied to Amazon S3 storage when they are uploaded to your WordPress media library. You can also do the same technique with your assets (CSS, JS, fonts, etc), but it requires the premium license to get the assets addon.

WordPress Amazon S3 and a CDN

If you are using a CDN to speed up delivery of your assets, you can enable this under the CloudFront or Custom Domain section. Check out these following tutorials to get you up and going.

Once you have it setup and your CDN URL, you can input it into the custom domain field as seen below.

cdn amazon s3

Related Articles

Haven't Found What You Need?

Head back to the knowledge base or open a support ticket

Back To The Knowledge Base Open A Support Ticket
grow traffic wordpress

Use WordPress?

Join 10,000+ others who get our FREE weekly newsletter with WordPress tips on how to drive more traffic and revenue to your business!

You have Successfully Subscribed!

Send this to a friend