[{"data":1,"prerenderedAt":74},["ShallowReactive",2],{"pattern-lambda-sns-sms":3},{"id":4,"title":5,"architectureURL":6,"cleanup":7,"contributors":13,"deploy":15,"description":18,"extension":19,"framework":20,"gitHub":21,"highlight":6,"introBox":30,"language":35,"level":36,"meta":37,"patternArch":38,"resources":57,"s3URL":6,"services":66,"stem":67,"testing":68,"videoId":26,"__hash__":73},"patterns\u002Fpatterns\u002Flambda-sns-sms.json","AWS Lambda to Amazon SNS",null,{"headline":8,"text":9,"test":12},"Cleanup",[10,11],"1. Delete the stack: \u003Ccode>sam delete --stack-name STACK_NAME\u003C\u002Fcode>.","2. Confirm the stack has been deleted: \u003Ccode>aws cloudformation list-stacks --query \"StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus\"\u003C\u002Fcode>",[],[14],"content\u002Fcontributors\u002Fbenjamin-smith.json",{"text":16},[17],"sam deploy --guided","Create a Lambda function that publishes directly to a phone number using SNS","json","AWS SAM",{"template":22,"payloads":28},{"projectFolder":23,"repoURL":24,"templateURL":25,"readmeURL":26,"templateFile":27},"lambda-sns-sms","https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-patterns\u002Ftree\u002Fmain\u002Flambda-sns-sms","serverless-patterns\u002Flambda-sns-sms","","template.yaml",[29],{"headline":26,"payloadURL":26},{"headline":31,"text":32,"test":26,"text2":26},"How it works",[33,34],"The SAM template deploys a Lambda function, and the IAM permissions required to publish an SMS message directly to a phone number via SNS.","The Lambda function handler uses the AWS SDK for javascript to send an SMS message using a 10-digit long code (10DLC) as the SMS origination number.","Node.js","100",{},{"icon1":39,"icon2":44,"icon3":47,"line1":51,"line2":54},{"x":40,"y":41,"service":42,"label":43},20,50,"lambda","AWS Lambda",{"x":41,"y":41,"service":45,"label":46},"sns","SNS",{"x":48,"y":41,"service":49,"label":50},80,"icon-mobile-device","Mobile device",{"from":52,"to":53},"icon1","icon2",{"from":53,"to":55,"label":56},"icon3","SMS",{"headline":58,"bullets":59},"Additional resources",[60,63],{"text":61,"link":62},"Choosing between messaging services for serverless applications.","https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fchoosing-between-messaging-services-for-serverless-applications\u002F",{"text":64,"link":65},"Publishing Messages in Amazon SNS","https:\u002F\u002Fdocs.aws.amazon.com\u002Fsdk-for-javascript\u002Fv2\u002Fdeveloper-guide\u002Fsns-examples-publishing-messages.html",{"from":42,"to":45},"patterns\u002Flambda-sns-sms",{"headline":69,"text":70},"Testing",[71,72],"Use the AWS CLI to invoke the Lambda function. The function name is in the outputs of the AWS SAM deployment (the key is TopicPublisherFunction):","1. Invoke the Lambda function to publish a message to SNS: \u003Ccode>aws lambda invoke --function-name ENTER_YOUR_FUNCTION_NAME outfile.txt\u003C\u002Fcode>.","MQIfgXQk1gXVDGdEDeBgUEsP42a0SnmiLTslJKGI4c4",1781606115308]