Search code examples
amazon-web-servicesamazon-cognitoaws-userpools

AWS Cognito using another region to send SMS


I have got an interesting issue with Cognito Userpool in AWS. I have created user pool for managing Users' signup/signin process in Mumbai region. Cognito was able to send otp via sms during signup process successfully from Mumbai region until we hit service limit exception. Hence we requested for service limit increase via support case and they increased to amount we requested. Soon after this, all the SMSes are starting to originate from Singapore region even thought cognito user pool resides in Mumbai region. I created a support case with AWS, unfortunately they asked to go with Premium plan to help on this. I have read about this issue at multiple forums and aws doesnt seem to be giving right answer. I can simply increase service limit in Singapore region and my issue will be resolved. But I believe that issue is with AWS and they had to fix it. Anyone else faced such situation and what was your approach ?


Solution

  • SMS messages from Amazon Cognito user pools are routed through Amazon SNS in the same region unless noted in the following table.

    https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-email-phone-verification.html

    There is no way to change this internal mapping. Ideally the easiest way is to increase the SNS spending limit in the region Cognito is using.

    Another option is to use this new feature:

    https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-custom-sms-sender.html

    It is a new Lambda trigger which is not available in the console but can be added in the CLI. You could use the AWS SDK to send the CODEs via SNS in the given region. I have not done this myself but should satisfy your usecase.