As there isn\'t any direct option to change machine type and i have to create a new instance. What are the steps to do so that the configuration/software that I had installe
You can't change the instance type of a VM on-the-fly. To upgrade or downgrade the VM type, you should do the following:
VERY IMPORTANT: make sure to not delete VM's boot disk while shutting down the VM; see this answer for details
shut down the VM cleanly while taking into account the information from step #1 if you're doing this via Google Developers Console or via gcloud
on the CLI by using the --keep-disks
option or by having already set those disks to not auto-delete as described in this answer:
gcloud compute instances delete VM \
--keep-disks=all \
--project $PROJECT
--zone $ZONE
Note that --keep-disks
accepts any of the following options: boot
, data
, or all
. In your case, you want at least boot
but if you've attached other disks, you want to specify all
. See the docs for more info.
create a new VM and choose a larger/smaller instance type: again, this can be done via Google Developers Console or via gcloud
on the CLI and instead of creating a new boot disk, select the boot disk from the original VM, e.g.,
gcloud compute instances create $VM \
--disk name=${DISK_NAME},boot=yes \
--machine-type ${MACHINE_TYPE} \
--project $PROJECT
--zone $ZONE
See the docs for more info.
1) Delete the instance that you want to upgrade by keeping its boot disk.
gcloud compute instances delete <instance-name> --keep-disks boot
2) Now create image from this boot disk
gcloud compute images create <any-image-name> --source-disk <instance-name>
3) Now Check Images list
gcloud compute images list
4) Now Create new instance from developer console or using gcloud compute
and select your image as boot disk.
5) Done.
Here is the link.
As of today, this ability can be seen on Google Compute Engine. You will need to stop the instance and then edit the instance.. which will give you a drop-down menu for the Machine Types
https://cloud.google.com/sdk/gcloud/reference/alpha/compute/instances/set-machine-type?hl=en