Search code examples
gitmacosamazon-ec2visual-studio-mac

Mac to EC2 - the source control Triangle Problem - git? rsync? WTH?


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 ?


Solution

  • 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.