title: SQS and AWS Lambda Integration
body: <p>I am developing an <strong>Audit Trail System</strong>, that will act as a central location for all the critical events happening around the organization. I am planning to use <strong>Amazon SQS as a temporary queue to hold the messages that in turn will trigger the AWS lambda function to write the messages into AWS S3 store</strong>. I want to segregate the data at <strong>tenantId level (some identifiable id) and persist the messages as batches in S3, that will reduce the no of calls from lambda to S3</strong>. Moreover, I want to trigger the lambda every hour. But, I have 2 issues here, one the max batch size provided by SQS is 10, also the lambda trigger polls the SQS service on regular basis, that's gonna increase the no of calls to my S3. I want to create a manual batch of 1000 messages(say) before calling the S3 batch api. I am not very much sure how to architecture my system, so that above requirements can be met. Help or idea provided is very much appreciable! </p>
  
  <p>Simplified Architecture:</p>
  
  <p><a href="https://i.stack.imgur.com/KXB5L.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KXB5L.jpg" alt="enter image description here"></a></p>
  
  <p>Thanks!</p>