How can I mount an aws linux instance locally? - mount-point

I work on a windows machine but I ssh into an AWS linux box to do most of my work. I'm trying to figure out a way I can use my local tools (specifically Spyder) to open up files (python files) from the server so I can edit them in the IDE and then run them on the server. (Note: its not just for code, I also want to be able to open csv's I generate, etc...).

Many modern IDE's provide this option through SSH, looking at the documentation for Spyder, it seems to refer to this configuration as a 'remote kernel'.
I do not use Spyder, but I use a similar configuration to do development with Visual Studio Code on my laptop with remote execution over SSH to an EC2 instance. In VS Code it is referred to as Remote SSH, you open a folder on the remote server as your VS Code workspace.

Related

Use Windows IDE to work with remote project on Linux

I have a project kept in Git repository which is compiled on a huge Linux server. Currently, I connect using SSH to the Linux server, modify the files there and then run commands to compile and execute it.
Everything is done in command line which is really painfull and I would like to use an IDE on my Windows machine which can connect to the remote Linux machine using SSH. I just need the IDE for file modification, auto complete and similar stuff, function resolution etc. I don't need to be able to compile or debug through IDE.
Mounting using Samba or Sshfs is out of the question because it is too slow. I need speed. If I click save, it needs to be save. Autocomplete should work like locally, it should work as though the files are on my machine most of the time.
Can somebody recommend an IDE which this qualities and information on how to set it up.
Thanks
The best thing that worked out for me is Unison. You have to have two copies of Unison, one on Windows client and one on remote Linux. You checkout the repository on the remote and then run Unison to synchronize the remote copy to your local. It connects to remote through ssh. Every time file is changed both locally or remotely, the other side gets updated instantly. Works well on slow connections.
You can then use your favorite IDE and work locally. The only quirt is that Unison must be same version and compiled with same Ocaml version (in my case Unison 2.48.4 with OCaml 4.0.4.). I had to compile it manually for Linux and for Windows I downloaded provided binary.

Connecting to Remote Windows Desktop

Need help.Wanted to know is there any module in Python which helps to connect to Remote windows and copies some text file, say vb file, and executes it and get the result test file back to source system which may be Unix (mostly) or windows. However, the destination is always remote windows desktop.
Earlier we used Winrm module and ran scripts on remote desktop. However, we got to know that some system does not have Winrm so need to change the tactic, tried searching but could not get any in Python.
You could use module os
and the os.popen() to use NET.exe service command or more advanced scripting tools like https://www.codeproject.com/Articles/9029/Push-and-Run-NET-Code-on-Remote-Machine. At least on windows NT like systems.

Remote development of Visual C++ applications from Linux

Remote development on Linux from Windows is easily doable via SSH.
However, what about the other way? I need to build and debug my Visual C++ application on Windows, but I want to work on a Linux system.
Cross-compiling via MinGW doesn't work because of MSVC-specific libraries
Ubuntu on Windows is a good start, but I'd like to work on a real Linux system
RDP/VNC or something like that doesn't help either, because than I'd work on Windows again
So does a virtual machine
Maybe something like Powershell on Linux + SSH to the Windows Powershell?
I regularly develop Visual C# applications remotely from Linux, not MSVC for the most part, but, like you, I wanted to find a way to build and debug Windows-targeted applications and libraries on remote Windows machines without working directly in the box using RDP, Visual Studio, etc.
It's difficult to answer this question without more information about the development and debugging tools you prefer to use on Linux for the types of applications you develop. I'll try to provide a general overview and update the answer for details you add about your workflow.
Cygwin, similar to MinGW's MSYS, provides a Unix-like environment for Windows. Most importantly, Cygwin, unlike MinGW/MSYS, includes an implementation of the OpenSSH server that enables us to connect to the Windows box over SSH from Linux (or any other device with an SSH client, really). We can install the sshd package using Cygwin's setup utility. After connecting, Cygwin drops us into a Bash shell by default. With this capability, we can:
Execute remote commands and scripts over SSH.
Edit files using our favorite *nix command-line text editor (Vim, Emacs, etc.)
Mount remote filesystems locally using SSHFS (if Windows shares are unavailable).
Forward or tunnel ports if needed.
The availability of a general-purpose shell makes almost anything possible. We can execute batch files, PowerShell scripts, and native Windows executables from Cygwin's shell environment in addition to Linux scripts and Cygwin programs.
For example, we could run msbuild from the SSH session command line to build our VC++ application or we could configure our local GUI editor or IDE running in Linux to execute msbuild over SSH when we click the "build" button.
We could set up a similar environment in recent versions of Windows using the Windows Subsystem for Linux ("WSL", Bash on Windows). I personally prefer Cygwin for greater portability and ease of configuration. Cygwin's sshd can run as a Windows service, and, as an established project, Cygwin integrates very well with Windows systems (user accounts, filesystems, Windows APIs, etc.).
Working with Code
We can choose from several workflows depending on our tools and comfort-level with the command-line:
Completely text-based—all work performed through the SSH session
Use local tools on files mounted in a remote filesystem
Use local tools and synchronize files
I use the first approach. I'm a heavy Vim user, so I connect to Windows machines over SSH to do my work on the command-line using the tools and environment provided by Cygwin. The availability of tools typically found on Linux simplifies many tasks that are hard to do from the default Windows console. We can write shell scripts to automate tasks that Visual Studio might normally do for us. For example, I wrote a wrapper script around mstest that reads the XML test results and outputs them in a format that's easy to read in a terminal.
If we prefer to use a GUI editor or IDE, we can mount the remote code locally so tools can read and write files as if they were part of the Linux machine's local filesystem. We likely still need to use SSH to execute commands needed to build the projects, but many editors allow us to configure this command as the project's "build" action.
Sometimes a remote filesystem is too slow for effective editing. In these cases, we can synchronize files between the Linux development machine and the Windows host using a tool like rsync or the editor's "upload on save" feature (over SFTP, for example), if available.
Debugging
Everything works pretty well until we try to find a way to debug our applications. As of now, there is no reasonable substitute for Visual Studio's debugger when working with Visual C++ projects. We can debug managed C# applications running on the CLR using MDbg, but no comparable tool exists for C++ programs.
We can try to use gdb (from MinGW, Cygwin, etc.) for basic, low-level debugging of native binaries, like reading memory addresses, but the debugger does not yet support reading Microsoft's debugging symbols, so the debugging experience is very limited. Microsoft began documenting the PDB format a couple years ago, so we may see some compatibility in the future. Even so, it will take a long time to produce a satisfactory alternative to Visual Studio's excellent debugging tools.
For debugging, RDP is currently our best—and probably, only—option. For a more native-feeling experience, we can run Visual Studio using rdesktop (or other RDP client) and seamlessrdp to create a single-window RDP session of the Visual Studio IDE instead of a full desktop which integrates with whatever window manager we're using on Linux.
Sometimes we can get around launching a full Visual Studio debugging session for simple debugging scenarios by adding tracing to our application that outputs values to the console or to a log file. In many cases, this is faster than starting the debugger anyway.
We can also try to use Eclipse's CDT debugger configured for the Visual C++ toolchain. This may enable us to perform remote debugging using an Eclipse instance on the Linux machine. I have never tried this approach, and I expect there may be some issues when the application is linked against Microsoft's libraries.
I don't know all your requirements, but maybe you could use a gdbserver on Windows (from MinGW) and remote debug from VSCode on Linux - or any other environment you like. You can find more details in this post here. (Watch out, VSCode prevents you from running gdb unless it’s signed as mentioned in the first link.)
There is also a Native Debug VSCode extension that could be helpful.
Another solution I can think of is to use Visual Studio Online (free for small teams up to 5 persons) as build server.
As you have said, the other way around is pretty easy and nowadays even officially supported by Visual Studio 2017.
Most probably, the VS remote debugging tools for Windows wont be helpful for you.

How to use ec2 instance as personal dev box using intellij as IDE?

I have searched the questions and have not found an answer to this one:
I am developing an existing project (git repo) that runs only on Linux. For the time being I have at my disposal only a windows laptop which I cannot modify. This laptop has Intellij installed and internet access. I cannot, for example, create a Linux VM on this laptop.
Is there a way I can put the project code on an Amazon ec2 Linux instance and build the project on that instance, while viewing and developing the code in Intellij? All compilation and code execution has to be done remotely, on the ec2 Linux instance. I cannot build locally and push from the windows laptop.
2 possible configurations might be:
(1) install intellij on the ec2 instance and x-window in from windows to view the intellij screens;
(2) use the intellij on the Windows laptop and somehow point the intellij to the ec2 instance in order to view, edit, build, and run the project on that instance.
Any ideas are greatly appreciated!
ec2 with enough memory for development is billed / hour. For 32gb RAM it's >$80/month (always online ~450h).
You could use wls 2 under windows. You can install IDEA and use it trough X server like
VcXsrv and access to windows files. It's not the best idea to run full GNOME (even xfce4). Google chrome also works very well
Downsides are:
(still) slow access to drive compared to raw Linux
I cannot configure WSL to access same VPN as in Windows. It simply cuts off internet connection for WSL while I click connect in windows.

Setting up Rsync to pull from Windows to Linux Box using cwrsync

I have a set of machines, a mixture of Linux and Windows Boxes.
I hav set up rsync to pull from the Linux Machines to a Linux Server box.
I am trying to accomplish the same using cwRsync, to pull to the Linux box from the windows machines. I have downloaded the free version from https://www.itefix.no/i2/content/cwrsync-free-edition and also I have downloaded CopSSH. I have managed to install CopSSH fine and I am able to SSH between the Linux and Windows hosts no problem using keys rather than passwords.
However, for the life of me I can't get this cwRsync working, I've googled the matter to death, and your meant to unzip the directory, configure the environment settings in the batch file then install it. However, there is nothing to install it with! and the reason it isn't working is because it needs to install a windows service for it to run.
Any help would be much appreciated!
As described at itefix web page for the free edition, it allows to initiate rsync from your Windows machine, i.e. client functionality only (push data). Server functionality allowing you to set up an rsync server on Windows to pull data from it is not a part of the free edition.

Resources