AWS SNS is not sending SMS anymore

Viewed 26061

I have been using Amazon SNS to send SMS for a while, but two days ago it stopped working. I didn't change anything on my side. Even if I try to send SMS from the console, it still doesn't work.

I only have 35% delivery rate for last couple of days, but since yesterday it is not working at all.

8 Answers

There are different ways to troubleshoot this problem. This is something addressed in the Developer Forum of AWS. Please go through the following steps to troubleshoot this problem. These could be basic steps, but I am pointing out the most general steps required.

  1. Try sending an SMS from the AWS Console. If this works, there is no issue with the spending limit or delivery rate. (So you have mentioned that this is not working too)
  2. Now check whether your Mobile number (which is receiving SMS) is subscribed to the topic. Under some conditions, the recipient can opt out from the topic.

Where required by local laws and regulations (such as the US and Canada), SMS recipients can opt out, which means that they choose to stop receiving SMS messages from your AWS account.

  1. Check the Account Spending Limit which you have set for your calendar month. This could be limiting your SMS delivery. If you haven't set this, the default is 1 USD per month.

For Account spend limit, type the maximum amount in USD that you want to spend on SMS messages each calendar month. When Amazon SNS determines that sending an SMS message would incur a cost that exceeds your spend limit for that month, Amazon SNS stops publishing SMS messages within minutes.

  1. For much more obvious reasons, check whether your Mobile Number (Which is receiving SMSs), is not blocking any of your SMSs.
  2. If none of these work, do contact AWS support team, they will get back to you within 2 working days. They will definitely sort it out. Until now, all my support calls were successfully resolved by their team.

Since yesterday, the messages have completely stopped coming so you might have reached the SNS SMS spend limit for your account. By default it is 1 USD for a AWS account in a AWS region. You should get your limit increased.

But in future if you want to prevent this i.e. if you want to get notified earlier before you reach the actual SMS Spend Limit for your account so that limit can be increased before hand. In this way you would not face SMS delivery issues due to limit being reached. You can create a CloudWatch Alarm on your SMSMonthToDateSpentUSD metric.

Please have a look at this video: https://www.youtube.com/watch?v=5-HdLf_lizI

  1. Check your dashboard for the topic - see if its reporting failed messages
  2. Check your phone number. If you're in US and don't EXACTLY do +1 + areacode + 7-digits - it will fail. (Notice the +1 prefix!!)

My case was that everything was working fine and suddenly the SMS isn't going through the nodejs code. After going through the responses above - I couldn't find any problem with the quota. Trying to send the message from the console worked.

Point 1 - By going through the cloud watch this is the response:

{
"notification": {
    "messageId": "ab4c51a2-d31c-5ba9-8c80-088d03fb0fbf",
    "timestamp": "2021-06-01 06:07:35.925"
},
"delivery": {
    "destination": "<Removed>",
    "smsType": "Transactional",
    "providerResponse": "total SMS message price 0.02171 is greater than requested Max price 0.003",
    "dwellTimeMs": 81
},
"status": "FAILURE"

}

So some of the people facing this issue might be having this problem actually. Since you specify a max price, you are willing to pay for the SMS being sent - and when the price is not right, it fails.

You can check here - https://aws.amazon.com/sns/sms-pricing/

My Question - To Anybody who faced this / can help is

In my case the price applicable was non-international - From India - India - $0.00278 and I had specified the rate as $0.003 to be on the safer side. However, for some strange reason - it is now picking up the price to be $0.02171 - i.e. for international messaging.

Please let me know if there is a way to restrict this to international/domestic - I didn't change anything in AWS settings/my own code when the problem cropped up.

Edit 1:

  1. I increased the amount and everything works. So it is because of the price only.
  2. Also I checked the region issue as well - as suggested by Javier Gomez above and my region is set to - Asia Pacific (Mumbai)ap-south-1 . So I think that even this is not causing the issue - as this has never been changed.

Thanks in advance.

I've been struggling with this as well. I noticed a banner on top of the SNS service that says:

Important changes for sending text messages (SMS) to US destinations Effective June 1, 2021, US telecom providers no longer support person-to-person (P2P) long codes for sending SMS messages to US destinations. To continue to send SMS messages to US destinations, register and use a valid origination ID. Learn more

So basically this means that if you want to send SMS to United States phone numbers, you must use Pinpoint to setup an "origination ID" which can be a toll-free number. They cost 2$ a month and they can be created instantaneously. Note that you should create it within the region that Cognito uses behind the scenes. For example, I have Cognito deployed in region US-East-2, but Cognito will actually use the SNS service from US-East-1 thus I created the origination ID there and everything started working again.

I hope this helps somebody else!

Check if your application is still in the sandbox environment

To check the same, go to console and go to SNS > Text Messaging (SMS) and add a phone number that you will be using for testing

enter image description here

It should work now if your credentials are correct. You can also use the dashboard to send SMS

I was expecting the same issue and got fixed with changing the region on my code. Go to your AWS Console (the one where you created aws keys), open SNS and check which region appears on the top right of the console, then use this region ID on your code. I don't know why but it was what resolved my problem... hope helps you.

I had what I believe is more of an edge-case compared to the above more common scenarios, but my solution may still be of benefit to someone who ends up in the frustrating situation I was in! I was sending SMS text messages using the SNS API for several months and then suddenly the sending began failing to the one destination country's mobile network - for no apparent reason. Reaching out to AWS support did not provide much insight besides them saying the destination network had an issue with the incoming message and I needed to investigate further myself. This was the SNS sending error in cloudwatch:

    ...
        "delivery": {
           "mnc": 10,
           "numberOfMessageParts": 1,
           "destination": "+27*********",
           "priceInUSD": 0.0198,
           "smsType": "Promotional",
           "mcc": 655,
           "providerResponse": "Unknown error attempting to reach phone",
           "dwellTimeMs": 679,
           "dwellTimeMsUntilDeviceAck": 2026
       },
       "status": "FAILURE"
   ...

After much research and experimentation, obtaining an official origination number from AWS PinPoint and specifying this origination number in the SNS API call resulted in the SNS SMS being sent successfully again.

Note: Also do your homework as to whether the target mobile network allows (or requires) Sender Id's - I was also initially setting a Sender Id, but had to remove this too before the above solution worked.

Here is the link to obtaining an origination number (I used a USA long code for my solution which costs $2 per month...): https://docs.aws.amazon.com/pinpoint/latest/userguide/settings-sms-request-number.html

The following python (Boto3) code sample shows how to set the origination number in the SNS call:

response = sns_client.publish(
    PhoneNumber='+27*********',
    Message='test',
    MessageAttributes={
        'AWS.SNS.SMS.SMSType': {
            'DataType': 'String',
            'StringValue': 'Promotional'
        },
        'AWS.MM.SMS.OriginationNumber': {
            'DataType': 'String',
            'StringValue': '+1**********'
        }
    }
)
Related