I was previously hosting this site on a WebApp instance in Azure but partly due to cost reasons I decided to migrate it over to AWS. There’s a variety of guides available to help with parts of this but nothing that covers the full process so I figured I’d try and document it below.
Create a Lightsail WordPress Instance
First you need to create a new WordPress instanse in Lightsail, set a static IP address for it and assign a DNS name. This is all explained nicely here.
Enable HTTPS
HTTPS is not enabled by default on you Lightsail site and will need to enabled manually as described here.
Migrate Existing Site
The next step is to export your current site from Azure and to import it into the new Lighsail instance. The easiest way to do this is by using the All-in-One WP Migration plugin. It’s pretty easy to export an existing site but there can be problems if the exported file is greater than the upload size limit for the new site, in my case this was 80MB.
In order to increase the upload size limit you need to edit the php.ini file of your new site, this is documented here.
To check the current upload limits of your Lightsail site you can run the following commands via SSH.
grep -i "upload_max_filesize" /opt/bitnami/php/etc/php.ini
grep -i "post_max_size" /opt/bitnami/php/etc/php.ini
If these are less than the size of the file to be loaded then you will need to open php.ini and modify these values, this can be done using the nano editor.
nano /opt/bitnami/php/etc/php.ini
The values that need updating are upload_max_filesize
and post_max_size
.
upload_max_filesize = 128M
post_max_size = 128M
After that has been done you should be able to import the file sucessfully.
Access MySQL
It turned out that the image URLs in my site were pointing at an azurewebsites.net address and not to their counterparts in my new Lightsail instance. The easiest way to fix this was to update the links in the underlying database tables.
To connect to the Lightsail MySQL database I used MySQL Workbench. Authentication is via SSH and the key can be downloaded from the Lighsail portal. The MySQL password can be retrieved by running the following command in the SSH console.
cat bitnami_application_password
0 Comments