title: Amazon SQS to files in Amazon S3
body: <p>According to <a href="https://stackoverflow.com/questions/52172497/how-to-stream-data-from-amazon-sqs-to-files-in-amazon-s3">this</a> if I want to create a lambda function to send the data from SQS to S3 each SQS message will be stored in an individual S3 object (I assume this is due the lambda function will be trigger each time the SQS recieve a message)</p>
  
  <p>Is there any way to send, for example, all the messages that SQS received in the last 24 hours to the same S3 object?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>This could be the code to received the message from the queue and send it to S3</p>
  
  <pre><code>var receiveMessageRequest = new ReceiveMessageRequest { QueueUrl = myQueueUrl };
   var receiveMessageResponse = sqs.ReceiveMessageAsync(receiveMessageRequest).GetAwaiter().GetResult(); ;
   while (receiveMessageResponse.Messages.Count &gt; 0)
   {
       if (receiveMessageResponse.Messages != null)
       {
           Console.WriteLine("Printing received message.\n");
           foreach (var message in receiveMessageResponse.Messages)
           {
               if (!string.IsNullOrEmpty(message.Body))
               {
                   &lt;...&gt; SEND TO S3
               }
           }
           var messageRecieptHandle = receiveMessageResponse.Messages[0].ReceiptHandle;
           //Deleting a message
           Console.WriteLine("Deleting the message.\n");
           var deleteRequest = new DeleteMessageRequest { QueueUrl = myQueueUrl, ReceiptHandle = messageRecieptHandle };
           sqs.DeleteMessageAsync(deleteRequest).GetAwaiter().GetResult();
       }
       receiveMessageRequest = new ReceiveMessageRequest { QueueUrl = myQueueUrl };
       receiveMessageResponse = sqs.ReceiveMessageAsync(receiveMessageRequest).GetAwaiter().GetResult();
  }
  </code></pre>
  
  <p>But, which would be the best option to send to S3? I mean, in S3 I would pay to put request and if I do it element by element this could be quite inefficient.</p>
  
  <p>I also imagine that storing items in memory would not be a good idea either, so im not sure what should I use for the best result</p>
  
  <p>Other question: when I developed locally i used ReceiveMessage but in Lambda function I have to use ReceiveMessageAsync, why this?</p>