How To Migrate your Wordpress site to AWS Lightsail
In this article we’ll go over how to migrate an entire Wordpress site with the Duplicator plugin (Database only method). In this example, my client has a Wordpress Managed Hosting plan with Godaddy and would like to migrate his site to a AWS Lightsail Instance.
The first thing we are going to do is login to our current website via FTP (I use FileZilla for my FTP client) and download the wp-content directory.
This may take a while depending on how big your site is. Once you’ve downloaded the folder, go to your current websites WP-Admin dashboard and go to add a new plugin.
Search for and install the duplicator plugin.
Activate Duplicator. Once active, you should see Duplicator should show up in the left toolbar.
Check out the quick start guide for reference: https://snapcreek.com/duplicator/docs/quick-start#quick-060-q
This is how you create a package (remember we are doing the “Database Only” method):
- Goto Duplicator ❯ Packages ❯ click “Create New” button
- On Step 1 Setup ❯ Archive ❯ check “Archive Only the Database”
- Build package then download installer and archive files
Once you’ve done this you should be able to download 2 files, one is a .daf extension, that is your database the other is an installer.php file that you will upload to your new server so that Duplicator can install the DB.
Now login to the AWS console: https://console.aws.amazon.com and set up your Lightsail instance:
Choose a plan (I chose the $5/month plan)
Name and create your instance:
Go to Home -> Networking and create a static ip and attach it to your new instance
Go back to your instances, then open up the terminal by clicking the orange “terminal” icon next to the 3 dots.
Once you are in the terminal, use this command to find your login credentials:
sudo cat /home/bitnami/bitnami_credentials
Take note of these credentials, you will use these to login to Wordpress on your website. For example you can now go to https://[your-static-ip-here]/wp-admin and login with these credentials.
While we are here in the terminal, let’s make sure that permissions and users are set correctly for when we want to upload our website files via FTP:
sudo chown -R bitnami:daemon /opt/bitnami/apps/wordpress/htdocs/wp-content/
Let’s now connect to our Lightsail instance via FTP, we want to do this so we can easily upload files. I’ll show you how I connect a Lightsail instance with Filezilla.
- Go to your Lightsail console: https://lightsail.aws.amazon.com/ls/webapp/home/instances
- Click on your Wordpress Instance
- At the bottom take note of the ip address, the user name, and click the link into the account page to download your private key file
- Now open up the FileZilla site manager, the icon on the top left of your application.
- Click on “New Site” on the bottom left of the window. On the top right, switch the protocol to SFTP. For the “Host” enter the ip address of your server. For the user type “bitnami” for the logon type choose “Key file” and browse to the .pem file you downloaded in the previous steps
- Connect to your site
- Navigate to the apps -> wordpress -> htdocs folder
- Upload the two files that we downloaded from Duplicator plugin, the .daf database file and the installer.php file to this directory.
- Now open up your favorite browser (I use chrome) and navigate to http://your-server-ip-address/installer.php
- Check that all the requirements pass, I encountered an issue with the permissions of my wp-config.php file.
- I edited the permissions by right clicking the file and adding “write” capability to the group:
- The override install notice is fine, that just means we are overwriting our current WP site which is empty. Check the boxes and click continue
- Next the Duplicator plugin will ask you to confirm that you want to override the current Database
- Confirm and click OK then Next
- This next step is important, Duplicator will update all links and assets such as images from your old server ip address to the new one. You can leave this with your new server ip if you would like, but I’ve had issues linking assets back with this before, so I prefer to change all references to the domain name which we are routing to the ip address in our DNS settings in the next steps.
- When you are satisfied with the setting, click next
- Duplicator will install the Database of your old website
- Next upload the wp-content directory we downloaded in the first step via FTP to replace the old wp-content
- Now go to your domain DNS settings, change the @ or A record to the IP address of your new server ip address. In my case this was Godaddy, refer to your domain provider to update the DNS. Refer to this article for help: https://www.domain.com/help/article/dns-management-how-to-update-dns-records
- Notice how I used https:// in the url of my data for Duplicator. To get an SSL certificate working for your bitnami wordpress instance, it’s super easy. Use the bncert-tool outlined here: https://docs.bitnami.com/aws/how-to/generate-install-lets-encrypt-ssl/
- Once that is done, your site should be completely migrated to your new server.
- One last thing there is to do, is in on the AWS Lightsail Bitnami wordpress, there is always a little icon in the corner
- To remove this icon login to your lightsail and SSH into your instance — then use this command:
sudo /opt/bitnami/apps/APPNAME/bnconfig — disable_banner 1
- Replace APPNAME with wordpress to disable the banner. Restart your instance and you should be good to go.
- Login to your sites wp-admin and remove the duplicator installation files from your root directory and your finished!
Thanks for reading, leave a comment and let me know if it was useful to you! Also drop a comment if you have any questions or need help. Peace out!
-Wes