Home > News > Migrate WordPress from CPanel to AWS Lightsail
In this guide, I will show you how to move your existing website or blog from a shared hosting account to AWS Lightsail.
Lightsail may be the solution for you if:
The first step is to create your Lightsail instance. Select the region you would like to create your instance in and then select WordPress.
Create a SSH key pair and ensure you save the .PEM file somewhere safe as you will not be able to redownload it. This .PEM file will be required later to connect to your instance.
After your instance has been created select the ‘Network’ tab and assign a public IP to your virtual machine.
If you do not complete this step, your instance may receive a different public IP address after a reboot.
Now that your instance is up and running with a public IP address, you can now connect to it via SSH. In this tutorial, I will be using PuTTY.
The first thing you will need to do is open PuttyGen and select “Load” to open the .PEM file you created earlier. You will then select “Save Private Key” (.PPK) somewhere safe.
Now that you have a PPK file generated you can connect to your new instance. Open a new PuTTY window and configure the following Settings
Save these settings as a preset within PuTTY for future use. Click “Connect” and you will be logged into your instance.
Now that you are logged into your instance, you can gather the default password on your new WordPress installation. Run the following command:
cat bitnami_application_password
The output of this command will give you the default password so you can login to your site (http://SERVER-IP/wp-admin) with the username “user”
Now that your new environment is up and running, you will want to tell WordPress to use your custom domain. Connect to your site via FTP or WinSCP (SSH) and modify your wp-config.php file which is found under /opt/bitnami/apps/wordpress/htdocsÂ
Edit this config file and replace this…
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/'); define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/');
…with this, remembering to update ‘domain’ to your real domain name.
define('WP_SITEURL', 'http://DOMAIN/'); define('WP_HOME', 'http://DOMAIN/');
After you have done this, you can update your machine’s local host file to point to your new environment if you wish.
Your certificate must be PEM formatted and follow the following naming convention.
Copy these files (replace what is there) under /opt/bitnami/apache2/conf. Restart Apache to see if the certificate updated correctly. If the cert and the key don’t match, Apache may fail to start!
At this point, you should have WordPress installation with your domain name and SSL certificate working. You can now migrate your database and content however you choose. For ease, I use the All in One WP Migration plug in, so I simply restore the latest backup file from my live site.
Once you have confirmed that everything is working as it should be you can update your DNS records to point to the new environment and remove the modification you made your local machine’s host file.