Lightsail instances are virtual private servers in the AWS Cloud. You have several performance options starting at $3.50 per month. If your application grows, and you need more memory, storage or compute, upgrading your instance is very easy. However, downgrading is not supported natively, since Lightsail instances the data is stored in fixed sized SSD disks.
This post described solution consisting of four main steps:
Connect to the old Lightsail instance using SSH, for example using the ‘Connect using SSH’-button in the online Lightsail portal . Change to the directory in which you wish to save your backup. Stop all servers (see line 4). Create a compressed file with the directory containing application data files (line 5). Additionally, to make a full backup, create a compressed file with the directory containing application binaries and runtime files (line 6). You can then restart the server to reduce downtime.
bitnami@ip-3-67-180-42:~$
cd /home/
sudo mkdir backup_bitnami
cd backup_bitnami
sudo /opt/bitnami/ctlscript.sh stop
sudo tar -pczvf application-backup.tar.gz /home/bitnami
sudo tar -pczvf application-bin.tar.gz /home/bitnami
sudo /opt/bitnami/ctlscript.sh start
Create a new Lightsail through the AWS Lightsail portal . Next, set its public IP to static using Create static IP under the Networking Tab.
WinSCP offers a graphical user interface of transferring our files. If you would not like to use WinSCP and are proficient in ssh
, you could also transfer the backup from the old to the new server directly. For now, let us stick with WinSCP to make life easy. In the Lightsail online dashboard, do te following for your old and new Lightsail instance:
3.67.180.42
..pem
file.Download and start WinSCP. Add both the old and new Lightsail instances to saved sessions. In the login screen that is propted upon startup, or can be found under the menu lint in the top of the screen by double clicking ‘New Tab’, perform the following steps:
3.67.180.42
)22
bitnami
.pem
file. WinSCP will ask you if you want it converted to a PuTTY Private key file (.ppk
), click OK. Save the .ppk
file, and select it as Private key file.On the old server, use WinSCP to navigate to /home/backup_bitnami
. Download the application-backup.tar.gz
and application-bin.tar.gz
backup files to a safe location.
On the new server, creating a directory using a bitnami_backup
directory using the WinSCP GUI may be tricky due to permission limitations. Therefore, connect to the new instance using SSH and do the following:
bitnami@ip-127-26-2-172:~$
cd /home/
sudo mkdir bitnami_backup
sudo chmod 777 bitnami_backup
# Go to WIN-SCP and transfer the application-backup and
# application-bin to the bitnami_backup folder on the new instance, then
sudo chmod 755 bitnami_backup
The following section is based on Restore Application Backups from the Bitnami documentation. Connect to the new Lightsail instance using SSH . Here we will do the following: 1) Navigate to the directory containing your backup. 2) Stop all servers. 3) Move the current stack to a different location. 4) Uncompress the backup file with the application data files to the original directory. 5) Additionally, to restore a full backup, uncompress the backup file with the application binaries and runtime files to the original directory. 6) Then finally, start all servers:
bitnami@ip-127-26-2-172:~$
cd /home/bitnami_backup
sudo /opt/bitnami/ctlscript.sh stop
sudo mv /opt/bitnami /tmp/bitnami-backup
sudo tar -pxzvf application-backup.tar.gz -C /
sudo tar -pxzvf application-bin.tar.gz -C /
sudo /opt/bitnami/ctlscript.sh start
In the online Lightsail portal :
NB: Do not delete the old Lightsail instance before you have verified that the new Lightsail instance works. It is best to just give it some time.
If you run into any issues with your website being unresponsive, please make sure all servers are up and running. (last step of part 6) If you can still not get things working, you can always redeploy the backup you saved to a save location by starting at step 6.