How to connect your WordPress site to an object storage bucket

using Amazon Lightsail

Amazon Lightsail is an easy-to-use virtual private server provider. Lightsail recently launched an object storage service. This tutorial walks you through the steps required to set up your WordPress site on Amazon Lightsail and connect the website to a Lightsail bucket to store website images and attachments.

To do this, you install the WP Offload Media Lite plugin on your WordPress website and configure it to connect to your Lightsail bucket. After the plugin is configured, all media that you upload to your WordPress website will be automatically added to your bucket instead instance’s disk.

Get started with Amazon Lightsail for free. 

About this Tutorial
Time 30 minutes   
Cost Free
Use Case Compute
Products Amazon Lightsail
Level 200
Last Updated July 14, 2021

Step 1: Prerequisites

Complete the following prerequisites.

1.1 —Sign up for an AWS account and navigate to the Lightsail console

Already have an account? Log in to your account

1.2 — Create a WordPress website on Amazon Lightsail. 

For more information, see Tutorial: Launch and configure a WordPress instance in Amazon Lightsail.

1.3 — Create a bucket in the Lightsail object storage service. For more information, see Creating buckets in Amazon Lightsail.

Step 2: Modify your bucket permissions

Complete the following procedure to change the permissions of your bucket to give access to your WordPress instance and the Offload Media Lite plugin. The access permissions of your bucket must be set to Individual objects can be made public (read-only). You must also attach the WordPress instance to the access role of your bucket. For more information about bucket permissions, see Understanding bucket permissions in Amazon Lightsail.

 

2.1 — On the Lightsail home page, choose the Storage tab and choose the name of the bucket that you want to use with your WordPress website.

2.2 — Choose the Permissions tab on the Bucket management page.

 Choose Change permissions under the Bucket access permissions section of the page.

2.3 — Choose Individual objects can be made public and read only.

 Choose Save. 

2.4 — Choose Yessave in the confirmation prompts that appear.

After a few moments, your bucket will be configured to allow for individual object access. This ensures that objects uploaded to your bucket from your WordPress website using the Offload Media Lite plugin are readable to your customers.

2.8 — Scroll to the Resource access section of the page, and choose Attach instance.

 

2.9 — Choose the name of your WordPress instance in the drop-down that appears, and then choose Attach.

After a few moments, your WordPress instance will be attached to the access role of your bucket. This ensures that your WordPress instance has access to manage objects in your bucket.

Step 3: Install the WP Offload Media Lite plugin on your WordPress website

Complete the following procedure to install the WP Offload Media Lite plugin on your WordPress website. This plugin automatically copies images, videos, documents, and any other media added through WordPress' media uploader to your Lightsail bucket, For more information, see WP Offload Media Lite in the WordPress website.

3.1 — Sign in to the dashboard of your WordPress website as an administrator. 

For more information, see Getting the application user name and password for your 'Certified by Bitnami' instance in Amazon Lightsail.

 

 

3.2 — Pause on Plugins in the left navigation menu, and choose Add New.

3.3 — Search for WP Offload Media Lite.

3.4 — In the search results, choose Install Now next to the WP Offload Media plugin.

3.5 — Choose Activate after the plugin is done installing.

3.6 — In the left navigation menu, choose Settings, then choose Offload Media.

3.7 — In the Offload Media page, choose Amazon S3 as the storage provider.

3.8 — Choose My server is on Amazon Web Services and I'd like to use IAM Roles.

Choose Next.

3.9 — Choose Browse existing buckets in the What bucket would you like to use? page that appears.

3.10 — Choose the name of the bucket that you want to use with your WordPress instance.

3.11 — In the Offload Media Lite Settings page that appears, make sure to enable Force HTTPS and Remove Files From Server.

  • The Force HTTPS setting must be enabled because Lightsail buckets use HTTPS by default to serve media files. If you don't enable this feature, media files that are uploaded to your Lightsail bucket from your WordPress website will not be be served correctly to your customers when they visit your website.
  • The Remove Files From Server setting ensures that media that is uploaded to your Lightsail bucket isn't also stored on your instance's disk. If you don't enable this feature, media files that are uploaded to your Lightsail bucket will also be stored on the local storage of your WordPress instance.

3.12 —Choose Save Changes.

Note: To return to the Offload Media Lite Settings page later, pause on Settings in the left navigation menu, and choose Offload Media Lite.

Your WordPress website is now configured to use the Media Lite Plugin. The next time you upload a media file through WordPress, that file is automatically uploaded to your Lightsail bucket, and is served by the bucket. To test the configuration, continue to the next section of this tutorial.

Step 4: Test the connection between your WordPress website and your Lightsail bucket

Complete the following procedure to upload a media file to your WordPress instance and confirm that it is uploaded to your Lightsail bucket and is served from your bucket.

4.1 — Pause on Media in the left navigation menu of the WordPress dashboard, and choose Add New.

4.2 — Choose Select Files on the Upload New Media page that appears.

4.3 — Choose a media file to upload from your local computer, and choose Open.

4.4 —When the file is done uploading, choose Library under Media in the left navigation menu.

4.5 — Choose the file that you recently uploaded.

4.6 —In the details panel of the file, you should see the name of your bucket in the Bucket and File URL fields.

4.7 — When you go to the Objects tab of the Lightsail bucket management page, you should see a wp-content folder. This folder is created by the Offload Media Lite plugin, and will be used to store your uploaded media files.

Congratulations

Congratulations. You have successfully connected your WordPress website running on an Amazon Lightsail instance to a Lightsail bucket to store website images and attachments.

Amazon Lightsail is a great choice to develop, build, and deploy a variety of applications like WordPress, websites, and blog platforms.

Was this tutorial helpful?

Read the documentation

Read the Bitnami documtation to learn how to perform administrative tasks on your WordPress website. 

Enable Object Versioning

Enable object versioning to preserve, retrieve, and restore every version of every object stored in your bucket. For more information, see Enabling and suspending object versioning in a bucket in Amazon Lightsail.

Learn more

Learn more about virtual private servers and Amazon Lightsail.