There are two ways to backup and restore a WordPress site on AWS that we often use
- Backuup the whole EC2 instance by creating a backup image
- Backup just the wordpress site using All-in-on plugin
Backup and Restore WordPress site using AWS plugin
- Advantage: you download and keep the file
- Not advantagge: the file is usually large, so you need to prepare your new server/host setting properly inorder to restore the site
Backup
Install the All-in-One Plugin
Restore
Create new AWS instance, make sure its storage is more than 10x the size of the backup file you are restoring
Assuming there is no domain channge, make sure you point the A-Record to the new server’s IP
After DNS change, we need to login the server and setup up SSL on the new site
Login and run with command line: sudo /opt/bitnami/bncert-tool
(Sometime if you chang server on the same machine you will get this message after you tried to login
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ED25519 key sent by the remote host is
SHA256:S8ash5rFkYdBrBxJunZtKCPhCRWyRE5k3zUOLp93xNY.
Please contact your system administrator.
Add correct host key in /Users/home/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/home/.ssh/known_hosts:60
Host key for theasiansupermarket.com has changed and you have requested strict checking.
Host key verification failed.
To resolve it run this command ssh-keygen -R <domain name>
Now make sure you can login to the website admin and yoru SSL works
Get the password for the site from the system log fo the EC2
The user / password is here
Make sure you can login your admin site with the user name password, go to <domain name>/wp-admin/
Once login, go to user profile and change password to the one you can remember
Now you need to setup the server for importing large backup file
Login your server EC2, use your favorite editor, i use vi to edit these files
Modify the following options in the /opt/bitnami/php/etc/php.ini file to increase the allowed size for uploads:
sudo vi /opt/bitnami/php/etc/php.inif
search for these variables and update values as followed
upload_max_filesize – set this to a value > than your backup
post_max_size – set this to a value > than your backup
memory_limit – set this to a value > than your backup
max_execution_time – set this to 0 (infinite)
sudo /opt/bitnami/ctlscript.sh restart
Now login to the site admin, click on All-In-One Migration, and import your backup file.