First we need to get an EC2 instance up and running using 64-bit Amazon Linux. I like to do this from their command line tools commonly known as their CLI. You can also do this from their console. Here we indicate that we want to use a small instance in the US East 1a data center.
This will take a few minutes to get this guy up and running. I look for running instances by issuing this command.
Once the instance is up and running, I ssh into the machine.
Let’s udpate all of the software on the machine and make sure that we have modern versions of everything.
Let’s grab all the dependencies we need to build and operate node.
Now we are going to make a directory so we can download and build node.
cd ~/node
Let’s download the most recent version of node and extract it into the ~/node directory
Configure the build for this operating system and environment.
Now we build node. grab some coffee. this will take a while (20 min or so). When it’s done we will install it.
sudo make install
Let’s kick the tires to make sure everything worked. You can CTRL-C twice within the node console to exit.
> console.log('it worked');
it worked
undefined
>
Let’s clean up the node build directory now that everything has been installed.
Ok, we’re done but that was kind of a pain. Let’s save this machine so we can resurrect it later and use node without going through all of that hassle. Amazon has a doc on this here.
AWS will return the name of the AMI so you can use that the next time you want to spin up node. If you want a new version of node you will have to start from scratch. Rats!!!!
Now the next time you want a machine like this with node installed you can spin it up with ease. And all of the software will be pretty much up to date so you won’t have to download as many security patches.