Migrating an Existing WordPress Site to AWS Lightsail
Introduction
In this guide we will walk through the steps to to migrate an existing wordpress website to a new AWS Lightsail instance.
Create a New Lightsail Instance
Description | Screenshot |
Log into the AWS management console | |
Click Create Instance | |
Choose the AWS Region, Platform, and Blueprint
As this is a wordpress example we have chosen London, Linux and an Apps+OS using WordPress |
|
If necessary generate a new SSH key pair and be sure to download the private key PEM file. | |
Choose your Instance plan | |
Give your instance a name | |
Click Create Instance | |
Setup your Lightsail Instance – Networking
Description | Screenshot |
In Light sail > Instances > Left click your instance | |
Here you can connect to the instance via SSH
Click Connect using SSH |
|
If you are keeping this instance then you should generate a Static IP Address for this instance so things like DNS can point to the server.
Click Networking > Create Static IP |
|
Select the Instance to attach this static IP Address to and give your static ip a name | |
Click Create | |
Instantly the IP address will be added to the lightsail instance. If you had any ssh sessions opened previously you will need to reconnect
Note that you can have up to 5 static ip addresses for your account and they are free only if attached to running instances. |
|
Setup your Lightsail Instance – Operating System
Description | Screenshot |
In the Lightsail console home
Click you instance Click connect using SSH |
|
In the console type to obtain the password of the wordpress ‘user’ account generated by bitnami | cat bitnami_application_password
Copy the password locally and keep it safe for later use |
Currently bitnami wordpress is limited to 40MB Uploads. You can edit the php.ini file and increase this as per this Bitnami Support doc
Browse to /opt/bitnami/php/etc/php.ini |
STEP1:
In php.ini find And change it to: STEP2 In php.ini find And change it to: ; Maximum size of POST data that PHP will accept. post_max_size = 512M ; Maximum allowed size for uploaded files. upload_max_filesize = 512M |
Restart Apache
Command: sudo /opt/bitnami/ctlscript.sh restart |
|
Optional
Update the WP All in one Plugin to work correctly upload files. Known Error: Uploading a .wpress file from the local device would |
In the console browse to
‘cd /opt/bitnami/wordpress/wp-content/plugins’ Command: ‘wget https://import.wp-migration.com/all-in-one-wp-migration-file-extension.zip’ |
Unzip the file | Command:
‘unzip all-in-one-wp-migration-file-extension.zip’ |
Log out of the console |
Setup your Lightsail Instance – WordPress Settings
Description | Screenshot |
User your internet browser to connect to the static IP address of your instance
http://<yourstaticIPaddress>/wp-admin User: user Password: whatever you obtained from the previous step bitnami_application_password file in the console |
|
Perform all wordpress updates – if available | |
Perform all plugin updates – if available | |
Update all themes – if available | |
Active the Wp All In One Migration Plugins | |
Click the Migration Import option in the left sidebar | |
Note the upload maximum is 512M (and not 40M) | |
Upload your .wpress file from a saved copy from your existing wordpress instance
(If you dont have one you can install the same Wp Migration plugin into your existing wordpress instance and ‘export’ it first so you can then import it to this new instance) |
|
Warming: You must ALSO know the existing wordpress instances username and password as these will be overwritten when the import completes.
Click Proceed if happy to continue |
|
Once complete be sure to click the ‘save permalinks structure’ and then click finish | |
Update your permalinks to your preferred format for your blog posts | Choose the format, then click save |
Site import complete |
Final Steps
Description | Screenshot |
You should update the lightsail instance(s) with
sudo apt-get update You should update any additionally imported wordpress themes or plugins and test the website is functioning perfectly. Especially things like contact us forms, reauthorising plugins (and moving stats for jetpack to this new site) You may need to import other things like ads.txt file or SSL certificates. See this article on how to create and import an SSL Cert into your Lightsail instance. |
|
You should go back to the Lightsail console and take snapshots of your instance(s)
Click Create Snapshot You Should also enable automatic snapshots, where lightsail will store 7 consecutive snapshots of your Lightsail instance, taken every 24 hours at the same time.
|
|
You should change your DNS settings to newly point to the static IP address of your new lightsail instance BEFORE you terminate your old website.
DNS time to live settings can be long so sometimes people may have cached the DNS record for your website with the old ip address for hours or even days. |
|