SQS triggered lambda function not creating more than 1 instance.

0

I have created a SQS FIFO queue and added a lambda function as a trigger. The problem I am running into is that whenever i put in messages (tested it with 60 messages) in the queue only 1 lambda instance is created. Even though there are 50 more messages (Batch size is 10) still in the queue.

I have waited for about 10 minutes the time it takes to process all the messages in the queue still only 1 instance is doing the job for that whole duration and any other instance is not getting created. I can tell because I can only see 10 messages in flight for the whole duration.

Details about the lambda function and SQS:

  • Lambda timeout: 15 minutes
  • Lambda memory: 2048mb
  • Batch size: 10
  • Maximum concurrency: 200
  • Default visibility timeout: 15 Minutes
  • Delivery delay: 0 Seconds
  • Receive message wait time: 20 Seconds
1 Resposta
2
Resposta aceita

Hi

Does your messages in the queue have different message group ID? Since it'c a FIFO queue messages with the same ID will be processed in order, as per documentation: Amazon SQS ensures that messages in the same group are delivered to Lambda in order. Lambda sorts the messages into groups and sends only one batch at a time for a group https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#events-sqs-scaling

profile picture
ESPECIALISTA
respondido há um ano
profile picture
ESPECIALISTA
avaliado há um ano
profile picture
ESPECIALISTA
avaliado há um ano
profile pictureAWS
ESPECIALISTA
Uri
avaliado há um ano
  • No, they have the same group ID.

    Thank you! I changed the code to send the messages in different group ids and it fixed the issue, now the lambda function is scaling as expected.

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas