Sign up for EC2

Create an instance, I used one from here, Alestic, paste in the ami-xxxxxx value to find the one you want.

Create an security group with at least SSH and HTTP.

Save your private key and connect like:

ssh -i your_key.pem

Update and install the needed packages:

sudo apt-get update
sudo apt-get install git-core g++ make curl libssl-dev

Install node, get latest url at

curl -O
tar -xvzf node-v0.2.6.tar.gz
cd node-v0.2.6
sudo make install

Node Package Manager

Install Node Package Manager.

sudo chown -R $USER /usr/local/{share/man,bin,lib/node}
curl | sh


This will be used to keep your node process running, forever. Restarting as needed.

keep NodeJS running with Forever

npm install forever

HA Proxy

HA Proxy

HA Proxy Logging

Quickly setup a load balanced high availability cluster

ACL Proxy Config for HAProxy


    log   local0
    log   local1 notice
    #log loghost    local0 info
    maxconn 4096
    #chroot /usr/share/haproxy
    user haproxy
    group haproxy


    log global
    mode    http
    option  httplog
    option  dontlognull
    retries 3
    option redispatch
    maxconn 2000
    contimeout  5000
    clitimeout  50000
    srvtimeout  50000

frontend http-in

    bind *:80
    acl is_domain_com hdr_end(host) -i

    use_backend domain_com if is_domain_com
    default_backend hello

backend domain_com

    option httpchk HEAD /check.txt HTTP/1.0
    option httpclose
    option forwardfor

backend hello

    option httpchk HEAD /check.txt HTTP/1.0
    option httpclose
    option forwardfor

change /etc/default/haproxy

# Set ENABLED to 1 if you want the init script to start haproxy.
# Add extra flags here.
#EXTRAOPTS="-de -m 16"


sudo /etc/init.d/haproxy start

sudo forever start path-to-app.js


NOTE: don’t forget to create and EBS AMI Image so your stuff is saved.


NodeJs for server newbs


EC2 Getting Started

Alestic AMI’s

NodeJS on your own AMI

Node as a service

HA Proxy Setup