Local Lambda against remote SQS?

Hi,

I’m currently evaluating localstack for work - it looks really good. One query however, if I want to debug an SQS consumer, can I have a local lambda function executing from a deployed SQS queue?

Thanks

Marc

Welcome to LocalStack @marc :wave:

That’s an interesting scenario. We currently don’t have a blueprint or tests for this exact scenario. However, it could work using our experimental AWS Replicator Extension. The replicator extension can be configured to forward relevant SQS calls using an ARN filter for your specific source queue. The relevant operations can be derived from the IAM policy AWSLambdaSQSQueueExecutionRole:

  • sqs:ReceiveMessage
  • sqs:DeleteMessage
  • sqs:GetQueueAttributes

The credentials used with the replicator extension also need to have permissions for these operations.

It is worth mentioning that LocalStack currently uses short polling (by default every second, configurable via an undocumented variable called LAMBDA_SQS_EVENT_SOURCE_MAPPING_INTERVAL_SEC).

Let us know if you have any further questions.

PS: We are working on improving Lambda Event Source Mapping. Stay tuned for updates in the coming weeks :chart_with_upwards_trend:

Best,
Joel

1 Like

Hi Joel,

Thank you for this, that looks very cool, i’ll dive into it tomorrow. Being able to hook into deployed infrastructure locally makes debugging and developing fixes a hell of a lot easier - obviously comes with security considerations but nothing that can’t be managed with IAM I don’t think.

Thanks

Marc

Hi Marc,

I have created some content around this specific use-case. Please find them here:

Please let me know if this is enough to get you started! :slight_smile:

1 Like

Hey Harsh, thank you, I was just discussing with one of my colleagues about testing this out, that will help a lot!

1 Like