[{"data":1,"prerenderedAt":64},["ShallowReactive",2],{"pattern-lambda-sqs-python-sls":3},{"id":4,"title":5,"architectureURL":6,"cleanup":7,"contributors":12,"deploy":14,"description":17,"extension":18,"framework":19,"gitHub":20,"highlight":6,"introBox":26,"language":30,"level":31,"meta":32,"patternArch":33,"resources":47,"s3URL":6,"services":6,"stem":56,"testing":57,"videoId":6,"__hash__":63},"patterns\u002Fpatterns\u002Flambda-sqs-python-sls.json","AWS Lambda to Amazon SQS",null,{"headline":8,"text":9},"Cleanup",[10,11],"1. Delete the stack: \u003Ccode>serverless remove\u003C\u002Fcode>.","2. Confirm the stack has been deleted: \u003Ccode>serverless info\u003C\u002Fcode>",[13],"content\u002Fcontributors\u002Falex-nelson.json",{"text":15},[16],"serverless deploy","Create a Lambda function that publishes to an SQS queue","json","Serverless Framework",{"template":21},{"projectFolder":22,"repoURL":23,"templateURL":24,"templateFile":25},"lambda-sqs-sls","https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-patterns\u002Ftree\u002Fmain\u002Flambda-sqs-sls","serverless-patterns\u002Flambda-sqs-sls","serverless.yml",{"headline":27,"text":28},"How it works",[29],"This Serverless Framework project deploys a Lambda function, an SQS queue and the IAM permissions required to run the application. The Lambda function publishes a message to the SQS queue when invoked.","Python","100",{},{"icon1":34,"icon2":39,"line1":43},{"x":35,"y":36,"service":37,"label":38},20,50,"lambda","AWS Lambda",{"x":40,"y":36,"service":41,"label":42},80,"sqs","SQS",{"from":44,"to":45,"label":46},"icon1","icon2","",{"headline":48,"bullets":49},"Additional resources",[50,53],{"text":51,"link":52},"Choosing between messaging services for serverless applications.","https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fchoosing-between-messaging-services-for-serverless-applications\u002F",{"text":54,"link":55},"Using AWS Lambda with Amazon SQS","https:\u002F\u002Fdocs.aws.amazon.com\u002Flambda\u002Flatest\u002Fdg\u002Fwith-sqs.html","patterns\u002Flambda-sqs-python-sls",{"headline":58,"text":59},"Testing",[60,61,62],"Use the AWS CLI to invoke the Lambda function. The function name is in the outputs of the AWS SAM deployment (the key is QueuePublisherFunction):","1. Invoke the Lambda function to publish a message to the SQS queue: \u003Ccode>aws lambda invoke --function-name ENTER_YOUR_FUNCTION_NAME outfile.txt\u003C\u002Fcode>.","2. Retrieve the message from the SQS queue, using the queue URL from the AWS SAM deployment outputs: \u003Ccode>aws sqs receive-message --queue-url ENTER_YOUR_QUEUE_URL\u003C\u002Fcode>","HtoQzu07qJ-2Tj6PWeKOGWu-mji_huTdxZeQYxyJWGo",1778846886699]