Monday, November 21, 2011

Step 3+4: Fun with Linux

Blarg.  Setting up an ec2 instance with node has been a pain.  Not quite done yet, but I'll share my AMI when I am.  I'm not going to go into all the details here, but let me share some mistakes I made.

Mistake 1: Amazon linux AMI.
When setting up a virtual server in ec2 you choose a base configuration to start with.  Looking at the options, Amazon has a custom AMI (amazon machine instance) that sounded lean and mean, so I chose that.  After configuring my keys and finally ssh-ing into the box though, I realized it's based on a different linux flavor than most online node.js tutorials are geared towards (it's CentOs instead of ubuntu).  I didn't want to abandon my new instance though, so I forged ahead.  Luckily I found this useful blog post:
http://wavded.tumblr.com/post/475957278/hosting-nodejs-apps-on-centos-5
but it's still been painful.  Now I've got node set up and all it's dependencies, but I'm still struggling with nginx.
Also, another thing that took me a while to find: the right way to ssh from a mac to an amazon linux ami:
ssh -2 -i <yourKey>.pem ec2-user@ec2-XX-XX-X-XXX.compute-1.amazonaws.com
Also, make sure your key permissions are restrictive enough:
sudo chmod 600 <yourKey>.pem

No comments:

Post a Comment