How to Upload Files directly to Amazon S3 bucket within WordPress admin

This article will show you how to use WordPress Amazon S3 Smart Upload plugin to upload files straight to S3 bucket without using local storage.

Requirement:

  1. Create an S3 bucket & get access key
  2. Configure S3 bucket under our plugin’s settings page
  3. Upload files directly to your S3 bucket

Create an S3 bucket & get access key

First of all, you need to create an Amazon S3 bucket storing your media file uploads.

Secondly, generate an access key that gives our plugin permission to access and upload files to this bucket.

Thirdly, go back to your WordPress website and configure your S3 bucket.

Configure S3 bucket

After activating our plugin, navigate to the plugin’s settings page under Media >> Upload to S3 menu from your admin dashboard.

You will see the guide to configuring your S3 access keys in wp-config.php file.

Put the following code at the top of your wp-config.php file and replace your AWS keys accordingly.

define('SSU_AWS_KEY', 'your-aws-key');
define('SSU_AWS_SECRET', 'your-aws-secret');
define('SSU_AWS_BUCKET', 'default-bucket');
define('SSU_AWS_REGION', 'bucket-region');
define('SSU_AWS_SUB_FOLDER', 'sub-folder-in-bucket'); // optional

When done, reload this page and start uploading your files.

Upload files to S3 bucket

The left sidebar of this page displays an upload button allowing you to select files to upload from your local.

Tick “Show it under media library” if you want to add the upload files to your media library.

Once added, these S3 files can be managed like other WordPress media files. For example, you can select and insert them into content through Add Media while editing any page or post.

The right sidebar shows your S3 bucket folder structure. You can see which files are stored on your S3 bucket as well as copying their S3 URL by simply right-clicking on the files’ title.

Lasted updated on February 12, 2020