How to do it...

Follow these steps to create a simple AWS Lambda function that processes messages from an Amazon Simple Queue Service (SQS) queue. The ability to automatically process all the messages in a queue with a Lambda function is an incredibly valuable feature that was announced by AWS in 2018. Anyone who has written code to poll a queue for messages knows that it can be surprisingly hard to do correctly, especially at scale with distributed systems. Adding this tool to your belt will allow you to tackle a wide variety of architectural challenges:

  1. Go to the SQS dashboard and create a new queue. Name the queue MySampleQ, choose Standard Queue, and click Quick-Create Queue.
  2. Go to the AWS Lambda dashboard and click Create function

Get AWS SysOps Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.