What is the best way to run a script remotely on Windows VM instance? - google-cloud-platform

For example, in Linux VM instances we can use gcloud beta ssh command to run commands remotely by downloading ssh keys using gcp credentials
Similarly, I am looking for running scripts on Windows VM instance remotely without doing RDP to an instance.
Can someone point to a solution for this problem?

If you have a Windows workstation with PowerShell, you can connect to your Windows Server instances through a remote PowerShell session. This process is similar to connecting to a Linux instance using SSH. Please review "Connecting to Windows instances using the PowerShell terminal"
https://cloud.google.com/compute/docs/instances/connecting-advanced#powershell

Related

Restart Datalab Kernel

With my Datalab instance, I can't run my script because the Kernel is dead and i don't have any option to select Python3 or Python 2.
I restarted the session and tried also to restart the VM also, but nothing changed, the Kernel option is still unavalaible to choose!
Can you help please?
There's an issue when connecting to Datalab from the Cloud Shell. You can workaround this issue by connecting to the instance without Cloud Shell and create a tunnel on port 8080 to display the Datalab UI on your machine.
In addition, I suggest switching to AI Platform Notebooks which provides an easy to use managed JupyterLab VM similar to Datalab and don't have this issue. Here's the quickstart to create a notebook.

Connecting to an AWS instance on windows from CLI

I am trying to execute the following command on cmdline (windows) ssh -i "publicec2instance.pem" #ec2-user<>compute.amazonaws.com
but it errors out saying
Failed to add the hosts to the list of known hosts (/home/<>/.ssh/known_hosts)
I tried to install cygwin to emulate unix cmd line to run the same command but it is not recognizing ssh itself.
Could you please point me in the right direction
SSH is used to connect to Amazon Linux EC2 instances.
To connect to Amazon Windows EC2 instances, use Remote Desktop (RDP).
Here is a document that will walk you this process.
Connecting to Your Windows Instance

GUI tools to access AWS EC2 running Ubuntu

I'm asking this here because google couldn't point me out in the proper direction. Are there any available tools for manipulating an EC2 instance via SSH using a GUI. I'm not very familiar with Ubuntu CLI commands (I actually crashed an instance by doing something over putty) so a GUI is my only option. What I actually want to do is to install a Glassfish web server on the instance. All necessary ports are forwarded (4848,8080,80).

How to run Windows instance on EC2 from Jenkins?

I have configured my Jenkins to execute a Linux instance on AWS EC2. This works absolutely fine and I am able to invoke Linux instances on EC2 via Jenkins. (Installed a couple of plugins; settings; creating custom Linux AMI etc.).
I want to run a Windows instance on EC2 via Jenkins. I have already setup a custom Windows AMI with Java installed and Winrm configured; a security group that allows TCP on port 445 and 5985; for SMB and Winrm respectively (https://issues.jenkins-ci.org/browse/JENKINS-4995).
I am able to invoke this Windows instance from Jenkins, but it never connects(just continues the loop "Connecting to ec2-54-191-40-110.us-west-2.compute.amazonaws.com(54.191.40.110) with WinRM as. Waiting for WinRM to come up. Sleeping 10s."
Please help me with the same.
you will need to create a new AMI and change the execution policy on it.
create a new machine from the AMI you mentioned above.
login to it and run the following from the cmd
powershell Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope LocalMachine
take a new image.
configure the new AMI in jenkins.
and you are good to go.
I ran into similar problem. However in my case it turned out that I had windows firewall enabled and it was blocking port 445 which is required before the winrm connection as revealed by plugin source code: https://github.com/jenkinsci/ec2-plugin/blob/0278dd242a554ff200144b813122505f6d8dcd0e/src/main/java/hudson/plugins/ec2/win/WinConnection.java
Look at the ping() method

Run ipython/jupyter notebook server on aws ec2 without an ssh client

I can set up a ipython/jupyter notebook server on aws ec2 by following this tutorial, it starts the remote server by entering $jupyter notebook in the local terminal.
However I also saw a pre-configured community AMI graphlab-create, which will run the remote server without the need of a Linux/Unix ssh client at all.
I'm wondering how that could be realized, since some students may not have an access to a linux/unix system. Any hint is appreciated.
Using windows is not an issue. I hooked up to my notebook in AWS from my home computer. I have Windows 10.
You can link up to AWS using putty.
I am using a Ubuntu AMI.
Once you have a terminal open you simply follow the instruction you gave in your link
It worked like a charm for me.