2
votes

I have an everyday EC2 instance. (Indeed, note that those change IPs each time you restart them, a further problem.)

There's a folder/ on the instance and I have a simple (say) Node project in folder (mysql, express etc). It's a web site, let's say.

So developing on my Mac ... how do you wrangle this?

Could run a git repo on the EC2 instance, edit locally on my Mac and push .. but the URL is always changing, nuisance.

Visual Studio Community does not unfortunately have any remote-editing, I believe.

(And really, you want to end up with the code stored in a repo somewhere, anyway.)

I could just have a git repo (or svn repo) on one of my own servers, and go in a triangle each time .. push .. pull .. seems inconvenient.

You'd have to constantly push, pull manually.

I'm happy to just use Nano on the shell but, you know, you don't get autocomplete and pretty colors.

Astonishingly, I find the best solution seems to be, using the $2 (perfectly engineered) Transmit sftp client on Mac ... they included an "edit with .. choose .. Visual Studio" button - hooray Transmit! Every time you save it sends up to the instance. That works, but Vis. doesn't understand it's a full "solution", it's just file by file, which is lame.

It seems remarkable there is no everyday solution to this "Triangle problem" - how to ?

2
Are you saying that a static IP address would fix things for you, or would you then still need a method to do "remote editing"?John Rotenstein
good point, @JohnRotenstein - even with a static IP it's still a "triangle" and I do not know the best solution.Fattie
@Fattie It would be fairly easy to automate the "triangle", wherein the target can automatically initiate a pull when it detects a change to the repo.cfiske
@cfiske - that's easy for you to say, you're an expert :) :) Why not put in an answer! I'll be adding an epic-size bounty for this canonical questionFattie
Lots of Mac + Visual Studio Code answers here: How to use VSCode to remotely edit website files They might be relevant for Visual Studio Community too. Also: Editing remote files locally in OSxJohn Rotenstein

2 Answers

3
votes

I can think of two ways to solve this:

  1. Create an Elastic IP and associate it with your instance. Then your IP doesn't change. (Personally I would create a DNS name for it anyway. It's easier to remember it when you need to, and it can be descriptive of what the host is.)

Couldn't be easier, but hard to find

  • go to your EC2 instance
  • left column click "Elastic IPs" under "Network & Security". (Not "Elastic Block Store")
  • simply click "Allocate" - done

enter image description here

  1. Use a dynamic DNS solution such as the one outlined here. Then your git URL can be a fixed name instead of a changing IP. Once you configure it your instance can update the DNS record whenever its IP changes.
0
votes

I see the elastic IP allowing you to push directly. A couple of additional options

Check out the aws-cli integration options which both deploy code (usually to s3) and then start ec2 instances that are attached to the code to run websites.

Or you could publish your work to github (public or private repo) and have a mechanism to have the EC2 instance connect & pull to its local storage (I'm assuming it has some persistent-ish).

Choices for notification include periodic fetch of a version file, method in your webapp to kick off etc.

Maybe just do it when the instance restarts & just restart it each time (rather brutish)