start VM on RDP request - azure-virtual-machine

I have a windows 10 VM in azure. I connect to this machine RDP. Because most of the time this machine is not in use (I'm not using it) I'd like, in order to save the costs, to shut down it.
My issue is to get back, to connect to it RDP after that. How do I start the machine remotely?

If you shutdown VM inside VM, you continue to pay for your VM.
If you shut down a VM from inside ( using Windows power options) or
through PowerShell by calling ShutdownRoleOperation with
"PostShutdownAction" equal to "Stopped".
More information please refer to this FAQ and this link.
You should use Portal or PowerShell to stop your VM.
If your VM is stopped(deallocated), you could use PowerShell to start your VM.
Start-AzureRmVM -ResourceGroupName $myResourceGroup -Name $myVM
More information about manage Azure Virtual Machines using PowerShell please refer to this link.
Also, you could start your VM on Azure portal. More information please refer to this link.
Notes: If you don't set static Public IP, the IP address will change.

Related

Google Compute Engine goes to sleep after some time

I'm trying to run my application on GCE VM. It uses nodeJs as frontend and a Java backend. I use this server to communicate with my local computer using MQTT. This is working but after some time (one hour and a half), the server seems to go to sleep (or the ports close ?).
Both MQTT and ssh terminal interface connections are lost.
When I connect back, the application is not running anymore, it seems like the VM restarted.
Do you have any idea on how to keep my server alive ? I can give further details.
Answering my own question as John Hanley explained the solution in comments:
"By what method are you running your frontend and backend code. VMs do not go to sleep. If you are starting your software via an SSH session, that will be an issue. Your code needs to run as a service. Edit your question with more details."
I was indeed running my application via the ssh terminal which caused the problem. The solution for me was to remotely access the VM via vncserver and to launch the application using the VM's terminal.

What keeps accessing Google Cloud metadata on my instance

I have a Google Cloud compute instance running with Ubuntu 18. We had wireshark running tracking another problem and we noticed that every minute something is accessing the meta data server. Three requests every minute:
GET /computeMetadata/v1/instance/virtual-clock/drift-token?alt=json&last_etag=XXXXXXXXXXXXXXXX&recursive=False&timeout_sec=60&wait_for_change=True
GET /computeMetadata/v1/instance/network-interfaces/?alt=json&last_etag=XXXXXXXXXXXXXXXX&recursive=True&timeout_sec=60&wait_for_change=True
GET /computeMetadata/v1/?alt=json&last_etag=XXXXXXXXXXXXXXXX&recursive=True&timeout_sec=77&wait_for_change=True
In call cases, the wireshark says the source is the IP of my instance, and the destination is the 169.254.169.254 which is the Google metadata server.
I don't have any code we have written that is accessing the server. The first one makes me think that this is some Google specific software that is accessing the meta data? But I haven't been able to prove that. What is worrisome is that the response for the third one contains ssh keys. Also, every minute seem excessive.
I see another post talking about scripts in /usr/share/google, but I don't have that directory. I do see that google-fluent is installed. I also see a installed snap for google-cloud-sdk. Could one of those be it? I don't recall installing them, AFAIK, I am not using it, so if that is it, what is the harm in uninstalling it?
You do not have a problem to worry about. The metadata server is private to your instance. The Google VM guest environment software and Stackdriver (fluentd) are making requests to the metadata server to get credentials, detect changes (new SSH keys), set the clock, etc.
The IP address 169.254.169.254 is an IPv4 Link Local Address. Only your VM has a route to that network.
Compute Engine Guest Environment
Do not attempt to uninstall the Guest Environment. You can remove Stackdriver, but I do not recommend that. Stackdriver provides logging and monitoring features that are very useful.

Can't keep SSH connection to VM using gcloud-sdk

I have a google cloud Deep Learning Virtual Machine Image for PyTorch that uses an SSH connection to connect to the Jupyter Notebook on it. How can I change what I am currently doing so that the Jupyter Notebook remains alive even when I close my laptop/temporarily disconnect from internet?
Currently after turning my VM and opening a tmux window I start up the Jupyter Notebook and its SSH connection with this command:
gcloud compute ssh <my-server-name> -- -L 8080:localhost:8080
This code is taken from the official docs for the deep learning images here: https://cloud.google.com/deep-learning-vm/docs/jupyter
I can then connect at localhost:8080 and do what I need to. However, if I start training a model for a long time and need to close my laptop, when I re-open it my ssh connection breaks, the Jupyter Notebook is turned off, and my model that is training is interrupted.
How can I keep this Juptyer Notebook live and be able to reconnect to it later?
NB. I used to use the Google Cloud browser SSH option and once in the server start a tmux window and the jupyter notebook within it. This worked great and meant the notebook was always alive. However, with the Google Cloud images that have CUDA and Jupyter preinstalled, this doesn't work and the only way I have been able to connect is through the above command.
I have faced this problem before on GCP too and found a simple way to resolve this. Once you have ssh'd into the compute engine, run the linux screen command and you will find yourself in a virtual terminal (you may open many terminals in parallel) and it is here you will want to run your long running job.
Once you have started the job, detach from the screen using the keys the keys Ctrl+a and then d. Once detached, you can exit out of the VM, reconnect to the VM and run screen -r and you will find that your job is still running.
Of course, you can do a lot of cool stuff with the screen command and would encourage you to read some of the tutorials found here.
NOTE: Please ensure that your Compute Engine instance is not a Pre-emptible machine!
Let me know if this helps!
I thinks it's better install Jupyter as server . so your job can keep running even when you disconnect.
There are something you might also want to know.
This is not the multi-user server you are looking for. This document describes how you can run a public server with a single user. This should only be done by someone who wants remote access to their personal machine. Even so, doing this requires a thorough understanding of the set-ups limitations and security implications. If you allow multiple users to access a notebook server as it is described in this document, their commands may collide, clobber and overwrite each other.
If you want a multi-user server, the official solution is JupyterHub. To use JupyterHub, you need a Unix server (typically Linux) running somewhere that is accessible to your users on a network. This may run over the public internet, but doing so introduces additional security concerns.

Google Cloud RDP not Working (User name & Password didn't work)

I just created a VM instance on Google Cloud for the very first time,
4 vCPUs
15GB Ram
Windows Server 2016 Datacenter
SSD 50gb
Access scopes - Allow default access
Firewall - Allowed bot http/https
Created
After that when am trying to connect thru RDP
(downloaded the rdp file and put the created password)
its saying
"The user name and password that were used to connect to the remote PC didn't work. Try a different account."
[am using Microsoft Remote Desktop on Mac]
I already tried creating new account & password... still no good..
Please help what could be the issues or solution.
Am using Google Cloud for the first time..
Thanks in advance
After you create a Windows Instance, you will first need to generate a password. Once you generate the password, paste it to a text editor. From here, you will need to install the RDP client for Mac. From here, you can follow these instructions which will explain how to connect to the Windows Instance using the RDP client you just installed.

Micro Cloud Foundry VM missing eth0

I am trying to get Micro Cloud Foundry working under Windows 7 64 bit with VMware workstation 7.1.4. For some reason, the VM starts with no eth0 only lo, therefore I never get a network connection. Ideas?
Do you have any other VMs running at the same time that may be using the same virtual adapter? Have you also checked the network settings on the VM to make sure a physical interface is selected on which to bridge the virtual adapter with.
As an alternate to deleting VM and starting from scratch again, and loose all your work, you could also rename the folder that contains the VM image. When relaunching VM from renamed folder, VMWare will ask whether you "copied" or "moved" this VM. Select the "I moved" option and then VMware will recreate the ethernet adapter configuration for you and you are good to go from then on