[{"data":1,"prerenderedAt":78},["ShallowReactive",2],{"pattern-s3-sqs-lambda":3},{"id":4,"title":5,"architectureURL":6,"cleanup":7,"contributors":12,"deploy":14,"description":19,"extension":20,"framework":21,"gitHub":22,"highlight":6,"introBox":31,"language":37,"level":38,"meta":39,"patternArch":40,"resources":58,"s3URL":67,"services":68,"stem":69,"testing":70,"videoId":30,"__hash__":77},"patterns\u002Fpatterns\u002Fs3-sqs-lambda.json","Amazon S3 to Amazon SQS to AWS Lambda",null,{"headline":8,"text":9},"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>",[13],"content\u002Fcontributors\u002Fahmed-mohamed.json",{"text":15},[16,17,18],"npm --prefix .\u002Fsrc install .\u002Fsrc","sam build","sam deploy --guided","Create a Lambda function that resizes images uploaded to S3 via SQS.","json","AWS SAM",{"template":23,"payloads":28},{"projectFolder":24,"repoURL":25,"templateURL":26,"templateFile":27},"s3-sqs-lambda","https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-patterns\u002Ftree\u002Fmain\u002Fs3-sqs-lambda","serverless-patterns\u002Fs3-sqs-lambda","template.yaml",[29],{"headline":30,"payloadURL":30},"",{"headline":32,"text":33},"How it works",[34,35,36],"The SAM template deploys a Lambda function, an SQS queue, 2 S3 buckets and the IAM resources required to run the application.","An SQS queue consumes ObjectCreated events from an Amazon S3 bucket if the file has .jpg extension. The SQS triggers a Lambda function.","The Lambda code checks the uploaded file is an image and creates a thumbnail version of the image in another bucket.","Node.js","100",{},{"icon1":41,"icon2":46,"icon3":49,"line1":53,"line2":56},{"x":42,"y":43,"service":44,"label":45},20,50,"s3","Amazon S3",{"x":43,"y":43,"service":47,"label":48},"sqs","SQS",{"x":50,"y":43,"service":51,"label":52},80,"lambda","AWS Lambda",{"from":54,"to":55},"icon1","icon2",{"from":55,"to":57},"icon3",{"headline":59,"bullets":60},"Additional resources",[61,64],{"text":62,"link":63},"Building resilient serverless patterns by combining messaging services","https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fbuilding-resilient-no-code-serverless-patterns-by-combining-messaging-services\u002F",{"text":65,"link":66},"S3-to-Lambda serverless applications","https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fs3-to-lambda-patterns","https:\u002F\u002Fda-public-assets.s3.amazonaws.com\u002Fpatterns\u002Fs3-sqs-lambda\u002Fcloudformation.yml",{"from":44,"to":51},"patterns\u002Fs3-sqs-lambda",{"headline":71,"text":72},"Testing",[73,74,75,76],"1. Run the following S3 CLI command to upload an image to the S3 bucket. Note, you must edit the {SourceBucketName} placeholder with the name of the source S3 Bucket. This is provided in the stack outputs.","\u003Ccode>aws s3 cp '.\u002Fevents\u002FexampleImage.png' s3:\u002F\u002F{SourceBucketName}\u003C\u002Fcode>","2. Run the following command to check that a new version of the image has been created in the destination bucket.","\u003Ccode>aws s3 ls s3:\u002F\u002F{DestinationBucketName}\u003C\u002Fcode>","DgKMdsHDN1vpbcYwQhk0sgpy60nRQx1UDSUHYiihFCo",1778927711007]