[{"data":1,"prerenderedAt":65},["ShallowReactive",2],{"pattern-sqs-lambda-cdk-python":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__":64},"patterns\u002Fpatterns\u002Fsqs-lambda-cdk-python.json","Amazon SQS to AWS Lambda",null,{"headline":8,"text":9},"Cleanup",[10,11],"1. Delete the stack: \u003Ccode>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>",[13],"content\u002Fcontributors\u002Fcorneliu-croitoru.json",{"text":15},[16],"cdk deploy","Create a Lambda function that subscribes to an SQS queue","json","AWS CDK",{"template":21},{"projectFolder":22,"repoURL":23,"templateURL":24,"templateFile":25},"sqs-lambda-cdk-python","https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-patterns\u002Ftree\u002Fmain\u002Fsqs-lambda-cdk-python","serverless-patterns\u002Fsqs-lambda-cdk-python","sqs_lambda_cdk\u002Fsqs_lambda_cdk_stack.py",{"headline":27,"text":28},"How it works",[29],"This pattern deploys deploys a Lambda function and an SQS queue. SQS invokes the Lambda function when new messages are available. The CDK application contains the minimum IAM resources required to run the application.","Python","100",{},{"icon1":34,"icon2":39,"line1":43},{"x":35,"y":36,"service":37,"label":38},20,50,"sqs","SQS",{"x":40,"y":36,"service":41,"label":42},80,"lambda","AWS Lambda",{"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},"Configuring a queue to trigger an AWS Lambda function","https:\u002F\u002Fdocs.aws.amazon.com\u002FAWSSimpleQueueService\u002Flatest\u002FSQSDeveloperGuide\u002Fsqs-configure-lambda-function-trigger.html","patterns\u002Fsqs-lambda-cdk-python",{"headline":58,"text":59},"Testing",[60,61,62,63],"Use the AWS CLI to send a message to the SQS queue and observe the event delivered to the Lambda function:","1. Delete the stack: \u003Ccode>sam delete --stack-name STACK_NAME\u003C\u002Fcode>.","1. Send the SQS message: \u003Ccode>aws sqs send-message --queue-url ENTER_YOUR_SQS_QUEUE_URL --message-body \"Test message\"\u003C\u002Fcode>","2. Retrieve the logs from the Lambda function: \u003Ccode>aws logs describe-log-streams --log-group-name '\u002Faws\u002Flambda\u002FENTER_YOUR_FUNCTION_NAME' --query logStreams[*].logStreamName\u003C\u002Fcode>.","Xq7D6r22qzedL2ukzsDBfjZ_voygk5ShRx4f0Hof1eo",1778846888265]