how to manage google compute engine group of instances disk image? - google-compute-engine

We are trying to create a horizontaly Scalable web service via Google Compute Engine.
In order to do so, we have created an Instance Template and a Group of Instances based on this new template. The group of instances create a new virtual machine (we chose Debian) in which we can install our NodeJs application and other stuff.
We unlucky found out that when the VM is turned off everything inside the VM is erased. We would like to create a Snapshot or a Disk Image in order to avoid completely rebuild an instance from sketch, but we encountered two problems:
You can't create a Disk Image while the VM is running but if we turn it off we would lose all data in it.
It is possible to create a Snapshot of a VM while it is running but when you create a new instance from the Snapshot we can't link/join the new instance to the Group of Instances.
How can we get to the solution with those tools?
Thanks

Although it is recommended to shutdown your VM instance before creating an image, it is possible to create an image of a running system.
Connect to your instance (SSH, RDP, etc.)
Shutdown the applications that you can such as databases, etc. This purpose is to minimize disk activity and changes to the file system.
Sync the file system to disk. Linux sudo sync. Windows: Sysinternals wrote Sync which will help. Sysinternals's Sync
Go to the Google Console -> Compute Engine ->Disks.
Select your the disk drive for the VM instance.
At the top of the screen will be a button CREATE IMAGE.
Click the button and complete the dialog.
Make sure that you click the button Keep instance running (not recommended).
Once the image completes, I would launch a new instance and verify that you have everything and that everything is working as expected.
Note: You can also create a disk snapshot.

Related

How do you change the public key of a Oracle Cloud Instance?

I accidentally deleted my public and private key and had to generate new SSH keys due to not being able to restore the keys (and not having a backup anywhere). How do I change the public SSH key then of my Oracle Cloud instance?
Terminating the instance and remaking it isn't an option, and I've tried looking online but wasn't able to find much. Any help would be appreciated.
Thanks
Some background
Found a solution! Just so people are aware, there are methods online that involve connecting to the machine via VNC, but for me personally it felt very trial-an-error, when pressing buttons at the wrong time, and it ended up not working properly (VNC didn't display recovery mode for me, just a blank screen after selecting it).
Summary
This guide involves: Creating another machine (as incl. in free tier anyway), detaching the boot volume drive from the machine and attaching it to the machine just created, to do editing to change the keys over, then attaching the drive back up.
Create another VPS (Oracle have them incl. > free tier)
I deleted one of my other VPS' in the Oracle panel (that was a free machine - as I didn't need it and wasn't using it) and created it again anew (I made sure to delete the old boot volumes before continuing).
(This solution is assuming your using Ubuntu 20.04, but this will probably work for other OS's as well)
Basically from there,
I powered off the machine I wanted to change my SSH key of.
After fully being powered off, just detach the boot volume from the VPS, and attached it as a block volume to the machine just created.
Login to the machine via SSH, and run the connection commands by hitting the three dots (image below) and viewing the connection commands, to connect the drive up.
Editing files on the drive & mounting process
Then by running blkid (or sudo fdisk -l for a more friendly view)
you're able to see what drives are available for mounting. So then you just make a folder and simply type:
sudo mount [drive path e.g. /dev/sdb] [folder path e.g. ./drive]
Edit the file at /home/ubuntu/.ssh/authorized_keys, or however your machine is configured (Oracle by default disallows root, but if you've edited your configuration it's up to your end).
Then, simply go to the relevant path to be able to unmount the drive, umount [folder path e.g. ./drive]
Run the disconnect commands for the drive from the panel.
Then, simply detach the drive from your other machine and reattach it back to the original machine. Wait till it's fully attached and then start the machine again.
You can create a console connection, connection to it, then reboot the instance (through OCI console), and get to GRUB in the console connection... a few more steps and you can upload a new ssh key: https://docs.oracle.com/en-us/iaas/Content/Compute/References/serialconsole.htm

Where is the link to phpmyadmin in Google Compute Engine?

I set up a LAMP instance in Google Compute Engine approx 45 days ago, and it came with phpMyAdmin already set up and accessible via a button in the console (in Compute Engine -> VM instances -> instance-name -> phpMyAdmin).
The button is now gone, and I can't find any documentation regarding the change. I can still access it via the browser at my-ip/phpmyadmin.
Just wondering if there was some recent change I was unaware of. I can update phpmyadmin manually but it appears that GCE no longer "officially" supports it.
I am assuming you deployed your LAMP stack via deployment manager. https://console.cloud.google.com/deployments/
If so, you should be able to access your deployment and all the relative details over there including login link for phpmyadmin.
As far as support from Google is concerned, since you have already deployed your instance, even if they remove it from their deployments, it will never affect what you have deployed. Moreover I just deployed a new instance and I can see that phpmyadmin is as an option (not sure if it always was). But even after adding it to my deployment, no extra instance for phpmyadmin was created. It is in the same instance as my rest of stack.
Since you are able to access it via your URL, there's nothing be worried about, and there are no changes on GCP side either. If anything, phpmyadmin is now optional.

How to clone/copy your instance on Compute Engine?

I created a VM Instance with Ubuntu Precise. Then I installed tons of libraries and set up my environment. I will be using another server with slightly different configurations therefore I want to copy or clone my current instance.
I thought the clone button which appears when I edit an instance was going to do the thing I desired but after I cloned my instance and go into the server, I haven't see any library installed or whatever.
Is there any way to completely create a new copy of a server (instance) like I can in Amazon?
Create a snapshot of your current instance
Create a new instance with this snapshot as a disk
There you go.
There is no native way to clone using gcloud. However you can fake it.
Use the UI console for this.
Navigate to the compute you wish to clone, and click clone.
At the bottom of the clone screen, click the 'Equivalent Rest or command line'; command line for the gcloud commands.
Copy that over to your console and execute the gcloud command.

Can't clone a VM instance from Google Developer Compute Console

I'm trying to clone an instance Centos based and in a load balancing pool. As soon as I click "create" I see the yellow baloon saying "creating instance...." but I don't see the task running in the Activities Windows and the message "creating instance..." freeze for ever.
So I tried creating the instance starting from a snapshot of the original instance but the result is the same. I'm not sure if something happened in the project or the problem is related to the fact the the instance is in a pool of the loadbalancer. Thank you.
This is the screenshot:

Openstack trove database instance status=error after creating a new instance

Recently I installed openstack trove using the automated script (devstack). After it is installed successfully and creating some user and projects, I manged to create a database instance and database inside it. unfortunately every database instance that I am going to build (via command line or horizon dashboard) trove gave me error status. Therefore when I tried to create database inside each of created database instance I stock with database instance is not ready.
I did some google and some people mentioned that I should check nova-compute.log, but unfortunately I did not find this log file. Would you please guide me?
Regards.
If you are running devstack it creates a screen session for all the services and it contains the logs. Try running "screen -x" to attach to the screen session and you can view the logs from there. Each window within the screen session is a separate service running.
If you had an issue creating an instance from trove it maybe because the image you are using is not setup correctly for trove because it needs the trove guest agent installed and a configuration for the guest agent baked in the image.
We have a repo that uses devstack to create a development trove installation that might be of use to test things out. This readme should help getting you started.
https://github.com/openstack/trove-integration/blob/master/README.md