[{"data":1,"prerenderedAt":68},["ShallowReactive",2],{"pattern-lambda-sns":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":51,"s3URL":6,"services":60,"stem":61,"testing":62,"videoId":26,"__hash__":67},"patterns\u002Fpatterns\u002Flambda-sns.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\u002Fjames-beswick.json",{"text":16},[17],"sam deploy --guided","Create a Lambda function that publishes to an SNS topic","json","AWS SAM",{"template":22,"payloads":28},{"projectFolder":23,"repoURL":24,"templateURL":25,"readmeURL":26,"templateFile":27},"lambda-sns","https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-patterns\u002Ftree\u002Fmain\u002Flambda-sns","serverless-patterns\u002Flambda-sns","","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, an SNS topic and the IAM permissions required to run the application. The Lambda function publishes a message to the SNS topic when invoked.","The AWS SAM template deploys the resources and the IAM permissions required to run the application.","Node.js","100",{},{"icon1":39,"icon2":44,"line1":48},{"x":40,"y":41,"service":42,"label":43},20,50,"lambda","AWS Lambda",{"x":45,"y":41,"service":46,"label":47},80,"sns","SNS",{"from":49,"to":50,"label":26},"icon1","icon2",{"headline":52,"bullets":53},"Additional resources",[54,57],{"text":55,"link":56},"Choosing between messaging services for serverless applications.","https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fchoosing-between-messaging-services-for-serverless-applications\u002F",{"text":58,"link":59},"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":46},"patterns\u002Flambda-sns",{"headline":63,"text":64},"Testing",[65,66],"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>.","EJNCunuNz75-AWM58J6AZu0HdYRvnV8jdMqYR8GWpVA",1778846886658]