Step-by-Step Guide to Migrate Your WordPress Site to AWS Lightsail
Today we are going to look at how to create & migrate a WordPress website on AWS Lightsail. You could either choose to watch the full video tutorial below, or read the article.
Create AWS Lightsail instance
Create your first instance by clicking the orange button “Create Instance”.
Creating new instance
The first step you need to do is to choose your location. You can either choose the one closest to you or the one that most of your visitors come from. It’s really up to you!
The second step is to choose Linux/Unix and then go for WordPress.
Scrolling down you will get to the point of where you can Enable Automatic Snapshots (that might be a good idea) and you need to choose your instance plan. AWS Lightsail is fairly flexible and you can always upgrade or downgrade if you wish.
I am going to choose the first option which is only $3.5 USD and also the first month is free (at this moment).
Identify your instance and then click the big orange button at the bottom “Create Instance”.
Alright, we are done here. Let’s move on.
Accessing your website
Pretty much as soon as you set up your instance you should be able to view your newly created WordPress website.
Click on your instance name:
Now find the Static IP on the right side of the screen:
You can put that Static IP in your browser address and access your website. Sometimes it takes a few seconds, so be patient.
Admin Dashboard Username and Password
To find out the password credentials we need to connect to our instance via the SSH terminal. To save time, we can use the handy browser SSH terminal that AWS provides.
Click on the “Connect using SSH” button.
The terminal should popup and look something like this:
Now type the following command:
Your password should be displayed in the middle like in the image below:
Now you can use:
|Password||t0DIXmNs30 – this is obviusly an example.|
To access your admin panel you can type your [youripaddress]/wp-admin
If you are stuck you can always read the official AWS documents.
Point a Domain in Amazon Lightsail
First of all let’s Create static IP address just in case our Public IP changes.
Go under the Networking TAB and click + Create static IP. Follow the instructions and save.
We can now use the new Static IP to add to our DNS address records aka (A Record). Note that sometimes DNS records could take up to 24 hours to propagate. You can alwasy check how the propagation is going by using a website such as Whatsmydns.net.
Update Domain name DNS records
This could be slightly different for everybody. Usually your domain name provider would have instructions on how to do this. Our main objective is to find our DNS settings. In 123-Reg they are under Advanced domain settings and then Manage DNS.
Click on Advanced DNS and update your A records with your new Static IP that we just created above.
That’s it, our domain name is now pointing to AWS. You can use the as Whatsmydns.net. tool to check if your record has been updated. It could take some time so be patient.
Inpatient? Once the records start to propagate, but your web address isn’t working yet, you can try to flush your DNS.
Now that we have the domain name setup, it’s proabably a good time to add our FREE Bitnami SSL certificate.
Setup FREE SSL (https) certificate Bitnami HTTPS Configuration Tool
Adding a Free SSL should be a fairly easy process. Go back to your instance and click “Connect using SSH” just like we did before. This time type the following command:
It might ask you to update the bncert tool. Just press ENTER – Yes and run the same script again:
The terminal will now lead you thrue the process of setting everything up.
Your newly installed SSL Cert should automatically update, but it’s always good to check from time to time to see if the automatic update works.
Access PHPMyAdmin in Lightsail
This is the shitty part. I wish that there was a better way of doing this and if you know of one, please comment below and I will update the article.
Ideally, I would want to access the PHPMyAdmin database using a tool like HeidiSQL or MySQL Workbench, but the solutions out there that I was able to find did not seem very safe to do. This is probably the safest way of accessing your database.
Download PuTTY+ PuttyGen. Usually when you download PuTTY, PuttyGen is automatically installed. If not find it and install that too.
PuTTY user interface looks like this. It’s a gorgeous tool!
Download PEM key
Navigate to Amazon Lightsail, click on the Connect Tab and at the bottom there will be a link to the Account page.
Once you are at the Account page, navigate to the tab SSH keys and from there you will see the download button. Download your PEM key.
PuTTY Key Generator
We now need to use the PEM key that we just downloaded to generate a public/private key pair. To do this, load PuTTY Key Generator, click Load and select the PEM key that we just downloaded. Once you do that, click on Generate and Save private key. Save the file somewhere for later use.
Open the PuTTY Coonfiguration tool and let’s start with the session Category. Click on Session, add your Host Name (or IP address) and set the port to be 22. Make sure that you name your session under Saved Sessions and click save so you don’t have to re-configure the settings later on.
Under Connection -> SSH -> Auth, you can now load the Private Key that we generated earlier with the Key Generator Tool.
Next click on Tunnels and set the Source port to 8888 and destination to be localhost. Then Click Add.
Now go back to Connections and click on Data. Fill Auto-login username to bitnami (that’s usually the default name).
The last thing that you want to do is go back to Sessions and Save your session. This is important as you don’t want to redo the setting every time.
Hopefully, at this point, you should be able to click open and connect to your server. If everything went well, you should get a similar command line like this:
We are sailing!
Last step is to go back to your browser and navigate to localhost:8888/phpmyadmin
Hopefully, you should see the PhpMyAdmin page and then you can log in. To get the password, go back to the AWS Lightsail console and do:
The username is usually set to: root
You can now import & export database if you wish to.
Connecting via FTP – FilleZilla
Before we do anything here, you need to first have your PEM key downloaded and also you need a tool like FileZilla. Let’s start with downloading the PEM Key.
Download PEM key
Navigate to Amazon Lightsail, click on the Connect Tab and at the bottom, there will be a link to the Account page.
Now that we have the PEM key, open Filezilla, click Edit -> Settings. Go to the SFTP page and add your key file. Once you do that, press OK.
In FileZilla, go to File -> Site Manager and create a New site. Select SFTP, add your host name which you can find from AWS Lightsail and add your password.
If you don’t know your password, you can go back to AWS Lightsail, connect using SSH and type the following command:
That’s it. Press Connect and hopefully, at this point, you should be able to access your WordPress files.
Migrating your website
Migrating your website is a matter of importing your database in AWS Lightsail, swapping the WordPress files via FilleZila and just make sure that the settings in your WordPress wp-config.php file are correct. That’s pretty much it.
Thank you for reading this article. Please consider subscribing to my YouTube Channel.