deploying to ubuntu instance on aws from windows - amazon-web-services

I want to deploy a python project to ubuntu instance on aws from a windows operating system, but all tutorials I have encountered either use ubuntu or mac as their development/local machine.
Is the deployment from windows the same i.e. after createing the instance all I would then be doing from the local windows system would be running inside the ubuntu instance?
is there any tutorial which can help me achieve my objective?
Note i am deploying directly without git.
ANy help would be appreciated

To transfer files to an ubuntu instance you could use SSH, from windows you could download an SSH client such as Mobaxterm (https://mobaxterm.mobatek.net/)! or download Windows Subsystem for Linux (https://learn.microsoft.com/en-us/windows/wsl/install-win10)! then use SCP to copy files (https://www.computerhope.com/unix/scp.htm)!. Both options require that you have the .pem security file for your instance

Your best bet is going to be installing WSL(Windows Subsystem for Linux) and using that to run bash commands. This will make your life a whole lot easier as you won't have to look for Windows specific tutorials and you can now follow Ubuntu/Linux tutorials.
What is WSL? It is essentially a Linux VM built into Windows. It will provide you with a terminal running Ubuntu or pretty much any other Linux distro you could want.
How to install WSL

Related

How to write native C++ in VS 2022, using Linux for build and test

I need a native C++ app to make from scratch. It has to run on linux (CentOS). I want to use VS2022 to write and test. I have Hyper-V VM with CentOS.
I tried to google a solution but there are only posts for using WSL.
Can someone please describe steps to connect VS to Linux VM instead of WSL so I can build and run the app on the VM.
This article describes the process: https://devblogs.microsoft.com/cppblog/linux-development-with-c-in-visual-studio/
add workload to the VS using VS Installer (Linux and embedded..)
create project of correct type
add SSH credentials in the project Properties (also can be added/removed/edited in Tools-Options-Cross Platform)

Node.JS native addons on LINUX [duplicate]

I'm using AWS Lambda, which involves creating an archive of my node.js script, including the node_modules folder and uploading that to their infrastructure to run.
This works fine, except when it comes to node modules with native bindings (using node-gyp). Because the binding was complied and project archived on my local computer (OS X), it is not compatible with AWS's (Amazon Linux) servers.
How can I cross-compile/install a node module (specifically, node-sqlite3) so when I upload it to another server arch it runs?
While not really a solution to your problem, a very easy workaround could be to simply compile the native addons on a Linux machine.
For your particular situation, I would use Vagrant. Vagrant can create virtual machines and configure them within seconds.
Find an OS image that resembles Amazon's Linux distro (Fedora, CentOS, others that use yum as package manager - see Wiki)
Use a simple configuration script that, when run by Vagrant on machine startup, will run npm install (optionally it might also remove the node_modules folder before to ensure a clean installation)
For extra comfort, the script can also create the zip file for deployment
Once the installation finishes, the script will shutdown the VM to avoid unnecessary consumption of system resources
Deploy!
It might require some tuning if the linked libraries are not at the same place on the target machine but generally this seems to me like the best and quickest solution.
While installing the app using Vagrant might be sufficient in some cases, I have found it necessary to build the app on Linux which is as close to Lambda's Amazon Linux AMI as possible.
You can read the original answer here: https://stackoverflow.com/a/34019739/303184
Steps to make it work:
Spawn new EC2 instance. Make sure it is based on exactly the same image as your AWS Lambda runtime. You can review Lambda env details here: http://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html. In our case, it was Amazon Linux AMI called amzn-ami-hvm-2015.03.0.x86_64-gp2.
Install nvm and use it to install the same version of Node.js as on the AWS Lambda. At the time of writing this, it was v0.10.36. You can refer to http://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html again to find out.
You will probably need to install git & g++ compiler on the EC2. You can do this running
sudo yum install git gcc-c++
Finally, clone your app to your new EC2 and install your app's dependecies:
nvm use 0.10.36
npm install --production
You can then easily download the node_modules using scp or such.
Same lines as Robert's answer, when I had to work on my MAC in a different OS I use vm ware like Oracle's free virtualizer VirtualBox to get a linux on my mac, no cost to me. Or sign up for a new AWS account, you get a micro for a year free. Use that to get your linux box, do whatever you need there.
AWS has a page describing how to deal with native NPM modules: https://aws.amazon.com/blogs/compute/nodejs-packages-in-lambda/

Can we communicate with windows instance using GCP composer?

I want to run my bat file on windows with the help of GCP Composer, but i am not sure if we can communicate with windows machine as composer is fully based on linux environment. Please help me if you have any solution.
There are a couple possible solutions described in this thread, basically:
Installing ssh into your Windows machine and then connecting to run commands remotely using the Airflow’s ssh operator.
Install a package like pywinrm, which allows you to run Windows commands on a target machine from Python code. Then, use the Python operator, within your DAG, to make the call. You may refer to the GCP documentation for steps on installing additional Python packages in Composer.

Dockerize a Visual Studio C++ project on Windows home

I am new to Docker, using windows 10 home edition, and want to create a docker image for my C++ project developed with visual studio. As far as I understand, the image I need to create is going to be a windows image, and therefore I need to install “Docker for windows” and enable the Hyper-V feature. This is not possible with my windows home edition, as Hyper-V is available for windows 10 pro only. The other alternative, using “Docker toolbox” and a virtualbox linux VM, does not support creating or pulling windows containers. Did I miss something? Is there a workaround?
You could use the Windows Linux Subsystem: https://medium.com/#sebagomez/installing-the-docker-client-on-ubuntus-windows-subsystem-for-linux-612b392a44c4
EDIT: On second read of your question you probably want to have a windows-container for visual studio. This solutions makes Linux-containers possible, but doesn't help with windows images...
As you know, you are unable to install Docker for Windows Home edition, as it requires Hyper V virtualization.
So these are your options:
You will need to install Docker Toolbox which uses VirtualBox instead.
Docs and setup info available here:
https://docs.docker.com/toolbox/toolbox_install_windows/
Release downloads available here:
https://github.com/docker/toolbox/releases
Toolbox will install everything you need including VirtualBox.
You may also need to enable virtualization in your computer's BIOS settings. This will be different for each manufacturer, please refer to their documentation on which keys to use to access these settings on reboot.
After Toolbox is finished installing, open the Docker Quickstart Terminal. This will complete the setup and provision your VirtualBox machine.
Check your install:
Launch the Docker QuickStart terminal and type the command:
docker run hello-world
This should pull down the test container and print hello-world to your screen.

Deploying a C++ application developed on Mac OS in a Ubuntu environment

I have developed a small web server based on Crow, link.
I'm pretty new to developing in C++ so all advices are greatly appreciated.
I'm developing the application on my Mac and intend to deploy it to a Ubuntu server.
I use Make to build the application so that I can run it on the Mac. The application is depending on two libraries, pqxx and png++. None of those are installed on the server.
I'd like to know how to run this application on the Ubuntu server. Mainly I guess the issue is, can I make a specific build on the Mac that is targeted for running on the Ubuntu server? Or do I have to build the application on the server?
Easiest way is to install Ubuntu on a VM on your Mac and deploy there your application.
Less easy solution: move source files on server, deploy the application, delete the sources from server.
Theoretically, both system are linux, so as long as you are using standard c++ libraries the code should run anyway.
In any case, the dependencies on Linux and Mac for Crown are different, so (most probabily) you have to install some libraries on your server.