Mapping an EC2 instance to a local drive on Mac

If you’re already using EC2, you’re probably familiar with SSH'ing to your box via Terminal with something like this:

ssh -i your_ec2_pem.pem your_ec2_instance_username_like_ubuntu@your_ec2_host.com

But did you know you can avoid this by creating a ~/.ssh/config file with details like this (obviously replacing the values with your specific EC2 details):

Host your_ec2_host
HostName your_ec2_hostname
User your_ec2_instance_username_like_ubuntu
IdentityFile ~/Downloads/your_ec2_pem.pem

Now when you want to SSH into your app, you can just open terminal and type something like:

ssh your_ec2_host

Nice…but let’s go one step further. Wouldn’t it be nice to just map your EC2 instance to your local machine as a network drive? Here’s how:

1. Download and install OSXFuse from the github project -> https://github.com/osxfuse

2. Download and install Macfusion from http://macfusionapp.org

3. Open Macfusion and create a new mapping (once you’ve created the config file from above, you can just enter the same details from that for your mapping and Macfusion magically figures out to use the pem file)

And that’s it…you should now have a Drive mapped on your local computer that you can open, explore, and interact with just like any other directory. Cool!

Note: Older macs may need/want/prefer to use Macfuse instead of OSXFuse…I’m currently running Lion, so I needed 64 bit support and therefore had to use OSXFuse.

Note: Though awesome that you can map drives like this, it can sometimes be slow access…so I highly recommend you adjust the preferences in Macfusion to have a lengthy timeout on mounting (I personally use 45 seconds)

Note: Once your drive is mapped, you do not need to keep Macfusion open/running. The mapping will remain until you restart or specifically unmount it.

This post has received 42 loves.


ARCHIVE OF POSTS



This is the personal blog of Kevin Marshall (a.k.a Falicon) where he often digs into side projects he's working on for digdownlabs.com and other random thoughts he's got on his mind.

Kevin has a day job as CTO of Veritonic and is spending nights & weekends hacking on Share Game Tape. You can also check out some of his open source code on GitHub or connect with him on Twitter @falicon or via email at kevin at falicon.com.

If you have comments, thoughts, or want to respond to something you see here I would encourage you to respond via a post on your own blog (and then let me know about the link via one of the routes mentioned above).