Amazon Cognito isn't delivering MFA text messages to my app's users. How do I troubleshoot this?
Last updated: 2019-04-22
When the users in my Amazon Cognito user pool sign in to my app, they don't receive a multi-factor authentication (MFA) text message with their one-time password (OTP) as expected. What's going on?
Amazon Cognito's MFA SMS (text) messages are sent with Amazon Simple Notification Service (Amazon SNS). When SMS messages from Amazon SNS aren't sending as expected, you can troubleshoot the delivery failure reason using Amazon CloudWatch Logs.
If you haven't already done so, first enable CloudWatch Logs for your SMS messages. Then, follow these instructions.
Review delivery logs using CloudWatch
Check the provider response logs of your SMS deliveries in the CloudWatch console. In each delivery status log, the providerResponse attribute contains the reason for delivery success or failure.
Note: If you just now enabled CloudWatch Logs for SMS messages, you won't see logs of your past SMS usage from before you enabled logging.
As a test, you can send an SMS message via Amazon SNS to your own mobile phone. If the test message doesn't arrive, check the logs for the provider response.
View your month-to-date SMS spending
Look at your Amazon SNS metrics to see your month-to-date SMS spending.
- Open the CloudWatch console.
- In the left navigation pane, choose Metrics.
- Under All metrics, choose SNS, and then choose Metrics with no dimensions.
- Under Metric Name, expand SMSMonthToDateSpentUSD, and then choose Graph this metric only.
Note: On the Graphed metrics tab, confirm that Statistic is set to Maximum. For more information, see the description of SMSMonthToDateSpentUSD in Amazon SNS Metrics.
- In the graph, note the value of the metric.
Check your monthly SMS spend limit
Look at your account's SMS monthly spend limit and compare it to your month-to-date SMS spending to determine if you've hit the limit.
- Open the Amazon SNS console.
- In the left navigation pane, choose Text messaging (SMS).
- Under Text messaging preferences, note the value for Account spend limit.
Note: For more information, see Setting SMS Messaging Preferences.
(Optional) Request a spending limit increase
If your account hit the monthly SMS spend limit but you want to send more SMS messages, request a spending limit increase. If you expect your monthly SMS usage to stay the same (or increase) going forward, a limit increase will also prevent the issue from happening again.
Avoid hitting the monthly SMS spend limit again
In addition to requesting a spending limit increase, you can also do the following:
- Create a CloudWatch alarm for the SMSMonthToDateSpentUSD metric. Set the alarm to notify you well in advance of hitting the spend limit.
- Monitor your SMS metrics and logs using CloudWatch to stay aware of your usage and anticipate your costs.
- View SMS delivery statistics and subscribe to daily SMS usage reports using Amazon SNS.