Problem:

Needed a way to send SMS, not via email or analog modem.
Didn’t want to send 20 000 per month, nor pay at that scale.

Solution:

Amazon Web Services: SNS (Simple Notification Service). Free tier.
Command-line tool (requires Java), or Python (boto project) good choices.

Example Setup:

Prerequisite: AWS account credentials, JRE.

  1. Install command-line tool, in this case, into /usr/local/sns/bin.
  2. In AWS console, SNS dashboard, create new Topic (class of notifications).
    Note topic id: arn:aws:sns:us-east-1:310221208693:com_kmpeterson_snstest
  3. In SNS dashboard, create new Subscription (link of topic to endpoint), protocol SMS.
  4. On phone, reply to subscription request to confirm.

Example:

The sample script and the configuration file with the AWS credentials.

~/sns_test.sh

#!/bin/bash
export AWS_SNS_HOME="/usr/local/sns"
export AWS_CREDENTIAL_FILE="/etc/aws/credential"
export AWS_SNS_BIN=$AWS_SNS_HOME/bin
export JAVA_HOME=/usr
TOPIC="arn:aws:sns:us-east-1:310221208693:com_kmpeterson_snstest"

$AWS_SNS_BIN/sns-publish $TOPIC --message "Testing..."

/etc/aws/credential

AWSAccessKeyId=0JZWYRWQSIOOS5C8X582
AWSSecretKey=p23afkgs6nQyNBdF9vwlf+x5e3Rh9WMAdw45mdff

And the execution of the script. The value printed is the message id.

$: ./sns_test.sh
dc46d33e-dc60-5e0a-b64b-9ae45f92d41b
$: