Bring your local development, to the cloud.
Tags: development, local, cloud, productivity
Published: 2019-11-20 18:26:38

It's really hard to work on a project, when your machine keeps blowing out air like a jet. Your palms get sweaty due to the machine getting really hot, and emulators, lagging out from time to time.

I develop on a 2015 15-inch Macbook with max specs. The project I am developing, requires to have a local MongoDB database, a local Redis datastore, backend running on the background, and the clientside (both Web and iOS & Android) all running at once. My battery can easily go from **100% to 5% in 40mins**.

Then one day it hit me. Why not have everything running up in the cloud, rather than on local. All this, and still be able to access everything like how you would develop, locally. So I started asking my colleagues in Slack, and one of them told me about [VSCode's Remote Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack). *But, will it actually improve development?* 

I started reading the [documentation](https://code.visualstudio.com/docs/remote/remote-overview) and from the looks of it, it's pretty easy to setup. For my case, I chose to have all the development stuff running up in a VPS, where I can just SSH to it from my local machine. I chose [Remote - SSH](https://code.visualstudio.com/docs/remote/ssh) and started reading from there. Later then, I found [this](https://code.visualstudio.com/remote-tutorials/ssh/create-website) guide to be really helpful.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/ww21c2cjjqru2ah029vo.jpeg)

In the guide, since this is Microsoft, it'll instruct the reader to spin up an **Azure VPS**. I chose to go for [**AWS Lightsail**](https://lightsail.aws.amazon.com) for 2 reasons:
- Cost is fixed monthly, and it's darn cheap.
- Since I'll be using it for stuff I am working on for the company, cost is waived!

Personally, I took the **4gb RAM, 2 vCPU and 80gb SSD**, which costs about **$20**. For having VSCode constantly running back and forth the VPS and local, and 2 Docker containers up, it's perfect. Regardless, it'll work with any VPS of your choosing.

Once I have the VPS setup, all I had to do then was to configure my Public keys around, and then from the VSCode interface, SSH in the VPS. It was hard to believe at first, but while I was connected, the terminal did not even lag. Everything is as smooth as how it's like when you develop locally.

Continued setting up Docker, download images, etc from the VSCode terminal directly. Then `git clone` the project I am working on into the VPS.

After 1 hour of setting everything up. It's good to go. I continued working from where I left off. Performance-wise, **you can't tell the difference between coding locally and coding on a VPS terminal**.

Currently, I have my **backend & web client** up in the VPS. I have my **MongoDB and Redis datastore** running in containers up in the VPS. Locally, I only need to run my mobile app code for debugging. 

As a software engineer that also develop mobile apps, whenever I debug on a physical device, it has become much more easier to connect to my backend just by accessing the public IP address of the VPS, instead of having the server running on ngrok or using `192.168.something.something`. I can just leave the dev server on without worrying it'll shut down if I close my Macbook.

Moreover, why not have individual VPS' for each projects that you work on, and just connect from 1 single VSCode? 

So, has it improved development? **Yes**.