Downgrade AWS Lightsail

Downgrade AWS Lightsail

Lightsail instances are virtual private servers in the AWS Cloud. You have several performance options starting at $3.5 per month. If your application grows, and you need more memory, storage or compute, upgrading your instance is very easy. However, down 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:

  1. Backup the old Lightsail instance.
  2. Create a new, smaller, Lightsail instance.
  3. Connect both instances to WinSCP.
  4. Transfer the backup to the new Lightsail instance using WinSCP.
  5. Apply backup to new Lightsail instance.

that we will downgrade our Lightsail server

1. Backup the old Lightsail instance

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. Create a compressed file with the directory containing application data files. Additionally, to make a full backup, create a compressed file with the directory containing application binaries and runtime files:

cd /home/ sudo /opt/bitnami/ctlscript.sh start

Hey!

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

2. Create a new Lightsail instance

Create a new Lightsail through the AWS Lightsail portal . Next, set its public IP to static using Create static IP under the Networking Tab.

3. Connect to servers with WinSCP

WinSCP offers a graphical user interface of transfering 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:

  • Copy the public IP from the Networking tab, e.g., 3.67.180.42.
  • Download default key from the Connect tab. This will download a .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:

  1. File protocol: SFTP
  2. Host name: (public IP, e.g., 3.67.180.42)
  3. Port number: 22
  4. User name: bitnami
    1. SSH → Authentication → Private key file → on Windows select to show all file types (.) → upload the .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.
  5. and give the site a name.

4. Transfer the backup to the new Lightsail instance

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 # drop application-backup and application-bin into bitnami_backup sudo chmod 755 bitnami_backup

5. Restore backup to new Lightsail instance.

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

Clean up after yourself

In the online Lightsail portal :

  • Disconnect static IP address from the old server and discard it.

  • Stop the old instance.

    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.

  • Delete the instance permanently.

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.