Downgrading a Lightsail
Downgrading a Lightsail is a bit more involved than Upgrading a Lightsail because you can't use an LS Snapshot to create an instance of a smaller size - it has to be the same size or larger.
Create a new Lightsail instance
Create the new smaller sized instance for the website you wish to downgrade.
Increment the number at the end of the site name (if it's currently named site-sitename then the new instance will be named site-sitename-2)
Deploy code to new Lightsail
- Grab the IP address of the new Lightsail and update the
ORIGIN_IPin Semaphore and perform another deployment. - Once successful, SSH onto the new Lightsail and confirm the new code is present (for example running
docker pswill show you the app name and that it's been running since the deployment)
Next Steps if your site HAS a Static IP
If the current website has a static IP address then the next step is easy:
Simply detach the Static IP address from the current LS and attach it to the downgraded LS (I find it easier to select the Static IP address to go to the Static IP Detail page - then click the Detach button, then select the new LS in the dropdown and click the Attach button)
Check the site is now live by visiting the website URL.
You are done! See Cleanup Steps below
Next Steps if your site DOES NOT HAVE a Static IP
Copy the IP Address of the new LS
Go to AWS CloudFormation > Stacks and look for your site in the list. Click it to go to the detail view for the stack
Click on the Update button, then Next button and you should see a page containing Parameters
Inside the OriginIp field you should see the current IP address of the old LS instance.
Paste in the new IP Address from step 1 and click Next and follow the steps until the Stack gets updated - this can take several minutes.
When the CloudFormation Stack status is
UPDATE_COMPLETEthen check the site is now live by visiting the website URLUpdate the
ORIGIN_IPenv value in Semaphore with the new LS IP Address, if you haven't already.You are done! See Cleanup Steps below
Cleanup
Press Stop on the old LS instance.
Check the site is still live just in case!
Add to your calendar for the next working day to Delete the old LS instance - I like to give it a day just in case something goes wrong and we quickly need to get the old site instance back up for some reason.