Configure WordPress for cloud storage on Amazon S3
NOTE: Before following the steps in this guide, ensure that you have an Amazon Web Services account with (optionally) an IAM user account and the corresponding AWS access key and secret key. You should also install and activate the WP Offload Media Lite for Amazon S3 and DigitalOceanSpaces plugin in your WordPress blog (instructions).
To configure Amazon S3 storage for your WordPress blog, follow these steps:
- Log in to your server console.
Open the file /opt/bitnami/wordpress/wp-config.php in a text editor and add the following lines to the file, after the initial <?php PHP tag:
define( 'AWS_ACCESS_KEY_ID', 'XXXX'); define( 'AWS_SECRET_ACCESS_KEY', 'XXXX');
Remember to replace the XXXX placeholder in the above lines with your actual AWS access key and secret key.
Save the file.
- Log in to your WordPress blog as an administrator.
- Select the “Settings -> Offload Media” menu item. Click the “Create new bucket” link.
- On the resulting page, create a new S3 bucket to store your WordPress media files by selecting a region, entering a unique bucket name and hitting the “Create New Bucket” button. You can also choose an existing bucket if you prefer.
Once the bucket has been created, you’ll be transferred to a page where you can configure plugin behaviour. Ensure that the “Copy Files to Bucket” and “Rewrite Media URLs” options are turned on. Other settings can be left at their default values or modified per your preference.
Click “Save Changes” to save your settings.
You can now add pages and posts to WordPress as normal. When you add a media file using the WordPress editor or media library, your media file will be uploaded to both the WordPress blog and the chosen S3 bucket.
The plugin will automatically rewrite URLs so that the media is served from S3 instead of from your WordPress host. In the screenshot below, refer to the image information panel, which shows the S3 bucket URL for the image.