Score:0

How do I upgrade an existing EC2 instance from Ubuntu 16.04 to 18.04 through CLI with custom Ubuntu 18.04 image?

cn flag

How do I upgrade an existing EC2 instance from Ubuntu 16 to 18 through CLI/ansible with our own Ubuntu 18.04 image?

Tried below steps and able to upgrade from 16 to 18.04 but it used ubuntu common image.

$ sudo apt update
$ sudo apt upgrade
$ sudo apt dist-upgrade
$ sudo apt-get autoremove
$ sudo apt install update-manager-core
$ sudo do-release-upgrade

But the requirement is to upgrade to 18.04 using custom AMI which is already created with specific requirements.

cn flag
You do not. You create a new instance at the AWS console and attach your data disk to the new instance. That is the ONLY way to guarantee you can go back to a previous setup. All other methods can lead to data loss or the loss of the complete instance,
in flag
EC2 instances are generally expected to be treated as disposable machines rather than "pets" that are taken care of for extended periods of time. If there is already a custom AMI available, could you not start some new instances and migrate any data from the previous system(s) to the new one(s)?
cn flag
The problem here is, the instances are provisioned through terraform and configured through ansible and around 1000 instances are in place now
cn flag
I would skip 18.04 and go straight to 21.04 :) Only issue is we found is mysql 8. A couple of noticeable changes there. But if this is anything like GCE/Google cloud the instance has software checking for the validity of the instance and won't boot if changed from the inside. You can update your personal files but I doubt it is possible to completely go to another version inside the instance.
cn flag
Is there any way we can provide our own custom image in below command?, it will download the packages from apt repository sudo do-release-upgrade instead can we point this to custom images
Score:0
cn flag

I was in a similar situation and had to upgrade an existing 16.04 ec2 instance to 18.04. Unfortunately, I only had ssh access to the server and not to the AWS console to allow for the 'proper' upgrade path as suggested by others. In any case it worked fine by running

sudo do-release-upgrade

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.