Send SMS texts with Amazon's SNS simple notification service
Amazon's Simple Notification Service makes it incredibly easy to send text messages programmatically.
Amazon SNS and SMS tutorial
In just a few simple steps, a systems administrator can quickly spin up the required SNS-backed text messaging infrastructure. And with only a few lines of code a developer can quickly create a RESTful AWS Lambda function that delivers an SMS messages when invoked. This short Amazon SNS tutorial demonstrates exactly how to set up an AWS environment to support text messaging with SNS. You'll learn how to configure origination numbers, create SMS messages in a Python-based Lambda function and have your texts sent any time your function is invoked.
How to create and send SMS texts with AWS
To create and send SMS text messages with Amazon SNS, and trigger the process from a Lambda function, follow these steps:
- Access the Amazon SNS console and navigate to the "Text messaging (SMS)" section.
- Request a phone number to act as the originator ID.
- Choose the host country for your originator ID and request a long-code number.
- Verify a recipient phone number in the SNS sandbox.
- Create an AWS Lambda function that programmatically sends SMS texts with the Amazon SNS API.
- Test the Lambda function by invoking its publicly accessible URL.
Canadian numbers and burner phones
Some countries make it more difficult to provision phone numbers. In the U.S., developers must provide personal details about themselves or about their company and wait up to 15 days to receive a phone number. This is an unacceptable delay for a motivated team anxious to get developing.
To remove such a blocker, I recommend developers register a Canadian phone number as the originator ID, which can be provisioned immediately. Then, use a burner app such as Hushed to create a temporary Canadian phone number to receive the SMS texts generated by your Lambda function. This will enable your team to start development immediately.
Amazon SNS makes it incredibly easy to integrate SMS text messages into your applications. You'll want to integrate phone-based text message notifications into every app you develop.
Cameron McKenzie has been a Java EE software engineer for 20 years. His current specialties include Agile development; DevOps; Spring; and container-based technologies such as Docker, Swarm and Kubernetes.