How to Host a WordPress Website on AWS Lightsail

Amazon Lightsail WordPress website tutorial

Hey there! Some links on this page may be affiliate links which means that, if you choose to make a purchase, I may earn a small commission at no extra cost to you. I greatly appreciate your support!

This tutorial will show you how to host a WordPress website on Amazon Lightsail. Additionally, we will link a domain name (assuming you have one) and install a free SSL certificate.

1. Get Started with Lightsail

First things first, go to and click on the Get Started with Lightsail button. Sign up for an AWS account if you don’t already have one.

Otherwise, click on Create instance and configure it with the following options:

  • Platform: Linux/Unix
  • Blueprint: WordPress
  • SSH: download the default SSH key
  • Instance: choose a plan with sufficient RAM, CPU, and storage

It will take a few moments for your instance to spin up.

2. Link Domain Name

If you have a domain name, you can link it to your AWS Lightsail instance by creating a DNS record.

Go to your registrar and find the DNS settings of your domain name. Create an A record that points to the IP address of your Lightsail server and another A record for the www version of your website that points to the IP address of your Lightsail server.

If you’re not familiar with this process, learn more about DNS A records here.

3. Login to Lightsail via SSH

There are two options for accessing your Lightsail instance.

  1. The browser-based SSH client
  2. Your own SSH client

You can access the browser-based SSH client by clicking on the orange Connect using SSH button under the Connect tab of your instance.

If you are on Mac or Linux, you can use Terminal to login via SSH and Windows users can either use Command Prompt or Putty to login. Here is an example of the SSH command to login to Lightsail.

chmod 400 Lightsail.pem
ssh -i Lightsail.pem bitnami@IP

If you configured your DNS settings in the previous step, you can also use your domain name instead of your instance IP address in the command above.

4. Bitnami for WordPress

Lightsail uses Bitnami to package together the environment for WordPress. The root Bitnami directory is located at /opt/bitnami/. In this directory, you will find subdirectories for the Apache web server, MariaDB, WordPress, and more.

5. Install SSL Certificate

Use Bitnami to request and install an SSL certificate for your Lightsail website.

sudo /opt/bitnami/bncert-tool

Type in your domain name when prompted. Here are my recommended answers for the remaining prompts.

  • Enable HTTP to HTTPS redirection: Yes
  • Enable non-www to www redirection: No
  • Enable www to non-www redirection: Yes

A few moments after providing your email address, you can access your website via its domain name in a web browser and check that it’s secure and being served over HTTPS.

7. Access WordPress Admin Dashboard

You can access the administrator dashboard for your WordPress website in a web browser at Of course, use your own domain name.

The credentials for the WordPress username and password are automatically generated for you on your Lightsail instance.

cd /home/bitnami
cat bitnami_credentials

Use this default username and password to login to your WordPress admin dashboard.

I recommend you go to the Plugins section and delete everything excepts AWS for WordPress and W3 Total Cache.

It’s also a good idea to tell WordPress that you want it to use HTTPS in the URLs. Edit the file at opt/bitnami/wordpress/wp-config.php and make sure the WP_HOME and WP_SITEURL values start with https.

8. Access the Database

Execute the following command to access your MySQL database’s command prompt.

sudo mysql -u root -p

Use the password from the previous step when prompted for it.

The Bitnami database for WordPress is called bitnami_wordpress.

show databases;
use bitnami_wordpress;
show tables;

A potentially easier option to access the database with a user interface is with the phpmyadmin administration tool and an SSH tunnel.

In a new Terminal or Command Prompt window, set up your SSH tunnel with the following and replace IP with your Lightsail’s IP address or domain name.

ssh -N -L 8888: -i Lightsail.pem bitnami@IP

Then you can access the phpmyadmin tool in a web browser at http://localhost:8888/phpmyadmin/.

Next Steps

Now that you’re all set up a fresh install of WordPress, check out my list of 15 important things to do after installing WordPress next.

Also for your convenience, the following is a detailed video walkthrough of the steps in this tutorial.

YouTube video


Meet Tony

Tony from Tony Teaches Tech headshot

With a strong software engineering background, Tony is determined to demystify the web. Discover why Tony quit his job to pursue this mission. You can join the Tony Teaches Tech community here.

Leave a Reply

Your email address will not be published. Required fields are marked *