Is it safe to upgrade AWS Ubuntu Instance running live sites?

12,332

Solution 1

Should I upgrade Ubuntu or leave it as it is? as any wrong package upgrade may break the server/live site.

Yes, you need to upgrade the cloud instance.

Is it safe to upgrade Ubuntu like this running do-release-upgrade

No.

or is there a better way to do it especially on live servers?

Yes, and there should be a how-to on this on the AWS platform (at least I know there is one on GCE so I expect there to be one on AWS too ;-) )

The general rule when dealing with cloud instances: prepare for failure. Screw up in any way and the instance is gone, dead, never ever to return.

The setup for an instance should be:

  1. a root disk that you create an instance with.
  2. a personal disk that gets added to the instance. This personal disk also has copies of all the files you edited on the root disk. This disk you also make backups off: you copy the disk in your dashboard so you have multiple copies. And if possible store them on another machine.

You do NOT use the upgrade tool from inside the operating system. Cloud instances that can not boot are -dead-. So if there is a failure where you would see a grub rescue when you use a normal desktop install you are screwed on a cloud instance.

But upgrading becomes a lot easier with cloud instances: you make a NEW root disk with the new OS and then attach a copy of your personal disk to the root disk where you examine the files you need to edit on the data disk for relevance. If this fails you still have your old instance. If it works all like you want you can start making backups of this setup and, over time, replace the old version backups with the new.

Solution 2

You can do sudo apt-get upgrade && sudo apt-get update as this will apply those 309 updates. For the release upgrade, I would suggest you clone your machine and try there or create a new one with the new LTS as these operations are not recommended over SSH.

Share:
12,332

Related videos on Youtube

iCyborg
Author by

iCyborg

Updated on September 18, 2022

Comments

  • iCyborg
    iCyborg over 1 year

    In 2015, I created an AWS instance running 14.04. After 2.5 years, I am wondering is it a good idea to upgrade as I see this message every day when I login to it?

    Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-48-generic x86_64)
    
    309 packages can be updated.
    235 updates are security updates.
    
    New release '16.04.4 LTS' available.
    Run 'do-release-upgrade' to upgrade to it.
    

    My questions are -

    1. Should I upgrade Ubuntu or leave it as it is? as any wrong package upgrade may break the server/live site.
    2. Is it safe to upgrade Ubuntu like this running do-release-upgrade or is there a better way to do it especially on live servers?

    Thanks

    • K7AAY
      K7AAY almost 6 years
      If you are asking about safety, then you don't make changes on a live system. Replicate it, upgrade it, test it, and then cut over.
  • Nathan B
    Nathan B almost 5 years
    Is there a more detailed article on how to do what you described on a live server with no downtime?
  • Rinzwind
    Rinzwind almost 5 years
    Yes but it should be common knowledge when using cloud services! Google cloud, aws and azure all offer instructions on how to do this. But basically you have 2 discs: one ssd and one hdd. Ssd has OS hdd your data. You create a new ssd OS with the new OS and connect the hdd to it. If it works you can nuke the old OS disc. If it does not reonnect the old one