( Google Cloud platform) I accidentally set up a firewall inside the Linux VM - google-cloud-platform

I cannot access the ssh console at all. Is there a way for me to download the disk inside the cloud platform?

You should be able to get onto the VM through a serial console:
https://cloud.google.com/compute/docs/troubleshooting/troubleshooting-using-serial-console
Alternatively, mount the disk on another, VM revert the change and then put it back on the original VM.

Related

google cloud shell open browser inside shell

is it possible to open the browser inside gcp cloud shell, or alternatively is it possible to have a desktop access to the cloud shell through the browser ? I am trying to run istio inside cloud shell, which I have done successfully. However to view the sample application I need to open a browser inside the cloudshell itself. I am not sure how to do it from my browser on my laptop and what uri I should use.
Yes.
It depends on your "client" for Cloud Shell.
If you're using the browser, there's a menu option that permits publishing a Cloud Shell port (this used to be a limited set of ports e.g. 8080 but I think it's now broader).
If you're using gcloud, you can use the following command to port-forward the Cloud Shell instance's CLDS_PORT to your host's HOST_PORT:
gcloud cloud-shell ssh --ssh-flag="-L [HOST_PORT]:localhost:[CLDS_PORT]"

How can I access boot disk from google cloud instance

My google cloud instance got a problem and it's preventing me to access the ssh. I would like to access the boot disk image from gcloud shell to download my files. How can I do that?
Thanks in advance
If you need to recover data from your existing boot disk of the problematic VM instance, you can detach the boot disk and then attach that disk as a secondary disk on a new instance so that you can have access to the data.
Detach the boot disk from the existing VM instance by running the following command.
gcloud compute instances detach-disk [INSTANCE_NAME] --disk=my-disk
Create a new VM and attach the old VM's boot disk as secondary disk by running the following command.
gcloud compute instances create [NEW_VM_NAME] --disk name=BOOT_DISK_NAME,boot=yes,auto-delete=no
Connect to your new VM using SSH:
gcloud compute ssh [NEW_VM_NAME]
Refer to the documentation that describes common errors that you may run into, when connecting to virtual machine (VM) instances using SSH, also ways to resolve errors for diagnosing failed SSH connections.
Create a new VM with a brand new disk. Add the problematic boot disk as additional disk. Start your new VM, log into it, and browse the additional disk to get your files.

Google Cloud Instance showing SSH instead of RDP (Windows instead of Linux)

I have a Windows Instance running in Google Cloud with two disks (ie boot disk and empty drive).
I manually logged into the machine and copied boot data into empty drive. I removed the boot and tried to spin up the VM with the empty drive and it was successful.
However, instead of showing RDP connect button now it is showing SSH. Any idea on why this is happening or how to solve the issue?
Which version of Windows are you installing?
Some new versions of Windows Server like "Core" versions only have access by SSH, the procedure that you have performed seems a little bit strange.
My suggestion is to redeploy your VM and check your attached disk looking for everything that is right on the boot disk.

unable to connect via rdp to a google cloud windows server vm

I have one instance of a Windows Server 12 R2 VM on google cloud that's working properly and I have connected to it successfully using RDP. I have tried to replicate it by creating a snapshot out of it and creating an instance from the snapshot. According to the platform the instance was created, but i can't seem to connect to it or to get a password. When I click "Get windows password" I get this:
forever. When i try to connect to it, I get
I have no idea what to do, any help would be appreciated.Thanks
The password creation tool from the console only works for images builted from the official image repo. In this case your source is a previous VM through a snapshot. In that case, and also in migrations all the previous credentials are kept in the new VM. You can download the GCP RDP agent here and access using the credential you used to have in your source VM.
Connecting to a Windows Instance
https://cloud.google.com/compute/docs/instances/windows/connecting-to-windows-instance
-----------Update----------------
In the case you can not get to enter the VM, it seems to be a firewall rules issue. By default the port tcp:3389(RDP access) is open to all VM at the default network, check your VM is in that network or check if the firewall rule has a tag to be applied.
If not, apply a tag to your new machine and create a firewall rule tobe applied to that tag.
Hope it help. Keep us posted!

Create VM without OS with Vagrant

For testing of automated OS deploy on a hardware cluster, I need Vagrant to create few VMs without OS installed, with just network boot enabled.
I succesfully created base box image and configured boot order with Vagrant.
Problem is that Vagrant dies after waiting for VM to boot (which it doesn't, because it has nothing to boot), trying to set up ssh forwarding, shared folders etc.
Is there any way I can tell Vagrant to just power on the machine and not try to configure or boot it?
Vagrant's idea is to manage already installed boxes. It has some requirements for them. SSH or other login access is a fundamental one.
If you just want to spin up a VirtualBox VM, you can call VBoxManage etc. directly.