Upgrade/Change the OS version of the VM instance in the gcp - google-cloud-platform

I am using Google-Cloud-Platform I want to update the os version of my VM instance.
I am using ubuntu-18.4LTS and want to upgrade it to the ubunut-20.04LTS with all the data.
I got one suggestion in which I ask I can create a whole new VM instance with the new OS that I want but in that case, I will lose the data.
Another Way that I come into my knowledge is using the snapshot.
Create a snapshot from the disk.
Create a new instance with the new OS version.
Add your old disk to your new instance.
But still, after doing this I didn't get any luck I got the new version but not the data of the old machine.
So is there any way to achieve this?

I can't use comment due to insufficient points.
Is there a reason you don't want to use command line to upgrade?
Does this link https://ubuntu.com/blog/how-to-upgrade-from-ubuntu-18-04-lts-to-20-04-lts-today help?
And this https://www.cyberciti.biz/faq/upgrade-ubuntu-18-04-to-20-04-lts-using-command-line/

Related

How to choose the correct Amazon-EC2 AMI for a Dockerized Django application?

I am trying to use an EC2 instance to host a Dockerized Django application with a postgresql db, and I am having trouble understanding how one would choose an appropriate AMI for this instance. For starters, does the OS of the instance matter? I thought the point of Dockerizing an application was so that it can run on any environment. Once the OS is chosen, how would one decide between the remaining choices?
Here is an example of some of the options
Thanks!
For starters, does the OS of the instance matter?
The instance doesn't mater, but it depends on what your preference is. What you're used to. I always go with the latest Ubuntu LTS. If you're going with Ubuntu the best place to find your image is at https://cloud-images.ubuntu.com/locator/ec2/. I suspect that all the other Linux flavors have a similar page. Just grab the image ID and search for it in Community images.
Once the OS is chosen, how would one decide between the remaining choices?
Once you select it choose your instance size, EBS size etc. This depends on your requirements. You can go as low as micro or as large as 32GB of RAM, or even larger. Depends what you need. I find the T3.large is really good for what I do, but yeah.

EC2 AMI and installed third party software - how does this work?

I've been using a Windows 2008R2 EC2 instance for some time. As of today, it still works. I started working with the AWS API, and I was unable to start my instance using the API, the error message being "not authorized for images", specifically : An error occurred (AuthFailure) when calling the RunInstances operation: Not authorized for images: [ami-088dab1e]
That's when I learned about deprecation.
From what I read, what this means is that the AMI being used is no longer publicly available. When using the API call "describe-images", this image cannot be queried. While it apparently can still be used from the console, the API simply doesn't support it and will not start an instance using that image ID. On the console, the AMI description reads : Cannot load details for ami-088dab1e. You may not be permitted to view it.
I understand how to find a new image and I think I understand how to launch my instance using a new image. However, I have lots of custom software installed on this instance. So before I try it, I want to know if I will lose that custom software installation if I launch my existing instance with a new AMI. I'm hoping that my custom software won't change, but I'm skeptical. I don't want to fire up a brand new version of Windows and start from scratch. Mostly, I don't want to lose what I've already got.
I know this is a basic question, but I've looked all over, and I haven't yet found a straightforward answer. I was hoping y'all would know. Thanks.
I think I've found an answer here: AWS EC2 new instance from image AMI
When launching an instance from an Amazon Machine Image (AMI), the disks will contain an exact copy of the disk at the time that the AMI was created.
In other words, if I start a new instance, I'll lose my installed software. WRONG!
Launching != starting. More editing to come once I get this completely figured out.
So, given that updated Windows images are created and deprecated all the time, and the Windows OS is constantly updated by Microsoft, one must wonder how it is a static Windows image can be used with other software? It seems like far more trouble than it's worth, if you've got to constantly reinstall your software to keep your Windows system up to date.
Amazon recently came up with a solution for that, here: Patching Windows
I don't know how to do it yet, but this seems like exactly what I need in order to keep Windows up to date, and keep my installed software intact.

GCE: create instance template out of disk snapshot

Is it possible? Official manual consists this:
Deterministic instance templates
Use custom images or disk snapshots rather than startup scripts.
But no more info how can I do this. Maybe someone have already did that? Tnx in advance.
It's possible. Here's the process:
Create your Snapshot
Create Disk from your Snapshot
Create an Image from Disk
Create an Instance Template from Image
So my solution is following:
I created an instance.
Install the required services on that instance.
Created the image from the disk using the steps mentioned on this link.
With that Image created a new template.
The startup scripts will run on instance boots up or restarts. So the only way I found to run it once is the same which you have tired i.e deleting them from metadata. In my setup when using startup scripts I don't reboot the instances I rather delete them and create a new ones if required.
I don't know whether it is anew feature, but you can simply replicate an instance by
Creating a snapshot
When the snapshot is ready, click on it (it'll show the details)
In the breadcrumbs bar, click on Create Instance.
It'll take a minute or so and the new instance will start-up, and that's all!

EC2 instance - complete reinstall

I have an EC2 instance up and running (Linux). I've made some installations I'd like to completely undo. What would be the best/simplest way to get back to a clean instance?
Start a new instance, running through your installation and configuration steps.
You can do this without terminating the old instance. This lets you look at configuration on the old instance in case you forgot how you set things up. It also lets you copy data or other files from the old instance to the new instance.
One you're completely happy with the new instance, terminate the old instance.
This approach of starting the new before destroying the old didn't make sense back in the days of physical servers, but EC2 gives us new ways to think about things.
Also: Document and/or script your installation and configuration steps so you can easily reproduce them in the future on new instances. Think about separating your data onto a second EBS volume so it can be easily moved to a new instance.
You should be comfortable with testing your setup scripts/docs repeatedly until they work just right on a brand new instance.
Destroy it and create a new one using the same AMI, kernel, and any user-defined data/script that you passed to the original instance creation. Back any of your own data up to S3.

A non-changeable VMWare image

I know the title is a bit weird, but I was unable to think a better one.
I wasunsuccessful in looking (googling) for creating a non-changeable VMWare image. I am not sure if this is even possible or not? Well the idea is that after VMWare restart I always have the same state.
Does anyone have any idea? Thanx in advance and hope it was not a completely stupid question.
Assuming you mean that when you power off your VM you want it to revert back to a known state and lose the latest changes, then this is possible with VMWare Workstation and I suspect other versions too.
You need to get the VM to the state you want to roll back too, shut it down and take a snapshot of this state.
You can now change the snapshot settings of the VM (VM->Settings->Options->Snapshots I think, but I'm not in front of VMWare at the moment, so may be wrong). Now you can set the VM to "When Powering Off: Revert To Snapshot". Now, every time the VM is powered down, it should revert to your known "baseline".
The only way I can think of you being able to do this Gico is that if you have a snapshot of the VM in whatever state you want, then revert to that snapshot whenever you need to, after a power down. This is definetly possible if you are using vSphere, not sure about the rest of VMware's products.
To do this in vSphere, get the machine in to the state you want, right click the VM in the vSphere Management console/ vCenter, select 'Snapshot -> Take Snapshot'. Then in the same snapshot menu use 'Snapshot Manager' to revert to that snapshot whenever you need to.
Maybe a way of reverting the snapshot automatically is described at this link:
http://www.vmware.com/support/ws5/doc/ws_preserve_sshot_revert_or_goto.html
Look in the Reverting at Power Off section.
It is possible to use 'Revert at power off' in VMware player too.