How to send SMS using Amazon SNS from a AWS lambda function
<p>Amazon SNS provides a facility to send SMS globally.</p>

<p>I want to send SMS from a Lambda function were we provide the mobile number and text message and use SNS to deliver that message but I didn't find a helpful documentation or example code for NodeJS or java.</p>

<p>Can any one suggest a solution?</p>

<p>Code:</p>

<pre><code>  var params = {
  Message: 'Hi this is message from AWS_SNS', /* required */
  MessageAttributes: {
    someKey: {
      DataType: 'String' ,
      StringValue: 'String'
    },
      },
  MessageStructure: 'String',
  PhoneNumber: '+91MyNUMBER',
  Subject: 'MYSubject',
  //TargetArn: 'arn:aws:sns:us-west-2:798298080689:SMS',
  //TopicArn: 'arn:aws:sqs:us-west-2:798298080689:SendSMS'
};
sns.publish(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});
};
</code></pre>