Can we send SMS through AWS for the below case?

I have an application installed on Ec2 and that application runs few rules and may send SMS to end users if the rule conditions are met.

I wanted to integrate it with some SMSC and thought of giving a shot with AWS-SNS. However, I am not able to figure out how will i integrate my application with AWS-SNS.

Going through the documentation of AWS-SNS I am not sure if this can be achieved. It talks about creating topics and assigning E164 numbers to topics but does not tell us how to integrate this with our already existing application.

  • While SNS can work for this... you might find a particularly focused SMS service like Twilio easier to work with, particularly if you're sending messages to lots of different numbers.
    – Tim Malone
    Commented Jun 17, 2018 at 3:38

1 Answer 1


I believe you will need to do this programmatically using the AWS SDK as described in Sending a Message (AWS SDKs). Here is a quote a from it:

To send an SMS message by using one of AWS SDKs, use the action in that SDK that corresponds to the Publish request in the Amazon SNS API. With this request, you can send an SMS message directly to a phone number


Sending a Message (AWS SDK for Java)

The following example uses the publish method of the AmazonSNSClient class to send a message directly to a phone number:

public static void main(String[] args) {
        AmazonSNSClient snsClient = new AmazonSNSClient();
        String message = "My SMS message";
        String phoneNumber = "+1XXX5550100";
        Map<String, MessageAttributeValue> smsAttributes = 
                new HashMap<String, MessageAttributeValue>();
        //<set SMS attributes>
        sendSMSMessage(snsClient, message, phoneNumber, smsAttributes);

public static void sendSMSMessage(AmazonSNSClient snsClient, String message, 
      String phoneNumber, Map<String, MessageAttributeValue> smsAttributes) {
        PublishResult result = snsClient.publish(new PublishRequest()
        System.out.println(result); // Prints the message ID.
  • It does not make much sense if i need to write a code just to integrate with a an SMSC type of thing, the application code should be agnostic to the SMS service/SMS gateway/SMSC used to send SMS. I do not want to ship the delivery of the code with coded integrations for AWA- SNS.
    – lakshayk
    Commented Jul 31, 2017 at 10:04
  • 3
    If you don't want to ship code that connects to a specific provider, then you need to write an abstraction layer and ship that separately - there's no way everyone is going to agree on a common API. Commented Aug 2, 2017 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.