[{"data":1,"prerenderedAt":73},["ShallowReactive",2],{"pattern-lambda-sns-sms-cdk":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":34,"level":35,"meta":36,"patternArch":37,"resources":56,"s3URL":6,"services":65,"stem":66,"testing":67,"videoId":29,"__hash__":72},"patterns\u002Fpatterns\u002Flambda-sns-sms-cdk.json","AWS Lambda to Amazon SNS",null,{"headline":8,"text":9},"Cleanup",[10,11,12],"1. Delete the stack: \u003Ccode>npx cdk destroy\u003C\u002Fcode>.","2. Confirm the stack has been deleted: \u003Ccode>aws cloudformation list-stacks --query \"StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus\"\u003C\u002Fcode>.","3. You see a message confirming DELETE_COMPLETE.",[14],"content\u002Fcontributors\u002Fian-larson.json",{"text":16},[17],"sam deploy --guided","Create a Lambda function that publishes directly to a phone number using SNS","json","AWS CDK",{"template":22,"payloads":27},{"projectFolder":23,"repoURL":24,"templateURL":25,"templateFile":26},"lambda-sns-sms-cdk","https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-patterns\u002Ftree\u002Fmain\u002Flambda-sns-sms-cdk","serverless-patterns\u002Flambda-sns-sms-cdk","app.py",[28],{"headline":29,"payloadURL":29},"",{"headline":31,"text":32},"How it works",[33],"The CDK template deploys a Lambda function with IAM permissions configured to publish an SMS message to a US phone number using a 10-digit long code (10DLC). The Lambda function publishes a message to the phone number when invoked. The AWS CDK template deploys the resources and the IAM permissions required to run the application.","Node.js","200",{},{"icon1":38,"icon2":43,"icon3":46,"line1":50,"line2":53},{"x":39,"y":40,"service":41,"label":42},20,50,"lambda","AWS Lambda",{"x":40,"y":40,"service":44,"label":45},"sns","SNS",{"x":47,"y":40,"service":48,"label":49},80,"icon-mobile-device","Mobile device",{"from":51,"to":52},"icon1","icon2",{"from":52,"to":54,"label":55},"icon3","SMS",{"headline":57,"bullets":58},"Additional resources",[59,62],{"text":60,"link":61},"Choosing between messaging services for serverless applications.","https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fchoosing-between-messaging-services-for-serverless-applications\u002F",{"text":63,"link":64},"Publishing Messages in Amazon SNS","https:\u002F\u002Fdocs.aws.amazon.com\u002Fsdk-for-javascript\u002Fv2\u002Fdeveloper-guide\u002Fsns-examples-publishing-messages.html",{"from":41,"to":44},"patterns\u002Flambda-sns-sms-cdk",{"headline":68,"text":69},"Testing",[70,71],"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 response.json\u003C\u002Fcode>.","w-ynjGNM4Ak2NeWxqt-nu9PJO4QLsBOTGoyERtgwaMQ",1778846886640]