HOW-TO: SMS via Amazon Web Services

(To be followed in order, as indicated below...)

Node.js and Express

Once logged into your EC2 instance, you need to add at least two items that will be used later to build a simple REST API for your SMS service: Node.js and Express.

This is going to be short and sweet. The version of Node.js that is packaged for Ubuntu is outdated and should be avoided. Instead of using the usual package installation method, execute the following commands in order at the command prompt to install Node.js and Express to your EC2 instance:

    curl -sL | sudo -E bash -
    sudo apt-get install nodejs
    sudo apt-get install npm
    sudo npm install express --save

We're not done yet. One very important player still needs to be installed: the Amazon Web Services SDK for Node.js. To be safe (APIs change constantly), let's install the version that is current as of the time this HOW-TO was authored:

    sudo npm install aws-sdk@2.2.37

With this version installed, we can be fairly confident that the instructions in this HOW-TO will be applicable to your installation. Of course, if you know of security issues that were fixed with a newer version of the SDK, do your best to adapt the instructions in this HOW-TO to work with the newest patched SDK.

We're almost there. We need to install one last bit of middleware to round out our Node.js installation: body-parser. This will be needed to parse JSON data from request-body content (if that doesn't make sense, don't worry, just install it):

    sudo npm install body-parser

That's all for Node.js, at least for now. We will get to the REST API and AWS SDK coding later. It's time to take a break from the EC2 instance and learn a few things about AWS SNS.