Among the subscriber types SNS supports are AWS Lambda functions, SQS queues, HTTP (S) endpoints using webhooks, email, and SMS. SNS is most useful for sending notifications of various events that happen in your AWS-hosted applications and for distributing information between different services in a microservice-oriented infrastructure.
Amazon’s Simple Notification Service (SNS) can send a text message (SMS) to mobile phones almost anywhere in the world. But how can we do this programmatically? This article shows how simple it is to send an SMS from a Node.js Lambda function.
Mobile text messaging (SMS) You can use Amazon SNS to send text messages, or SMS messages, to SMS-enabled devices. You can send a message directly to a phone number, or you can send a message to multiple phone numbers at once by subscribing those phone numbers to a topic and sending your message to the topic. Supplemental Nursing System (SNS) The Supplemental Nursing System is an ideal way to administer supplemental nutrition to babies while they are being breastfed. The system supports the unique bonding between mum and baby, motivating both of them to keep moving towards a more satisfying breastfeeding experience. Tyranny - deluxe edition upgrade pack crack.
Let’s start by creating a Lambda function with the required permissions:
The SNS publish policy shown above, permits this function to perform the action “SNS:Publish” on resources “arn:aws:sns:*:*:*”. In our case, the resource will be a phone number, so it won’t match the resources expression. If you run the function now, it fails with an error
:
So open up this role in IAM & edit its policy to look like this:
Now, onto the code! The absolute bare minimum code required to get an SMS to your phone is shown below. It uses the JavaScript AWS SDK to publish to SNS. The publish params tell SNS that this is an SMS notification & not an email, etc.
That’s it! That’s all it takes. Simple, isn’t it? You can learn more about SNS’s publish API here.
Harish KM is a Cloud Evangelist & a Full Stack Engineer at QloudX. He is very passionate about cloud-native solutions & using the best tools for his projects. With 10+ cloud & IT certifications, he is an expert in a multitude of application languages & is up-to-date with all new offerings & services from cloud providers, especially AWS.