Create SQS queues on localstack container start

Put this file to your filesystem as ←anyname.sh→:

For instance, ./localstack_bootstrap/sqs_bootstrap.sh.
Don’t forget to run chmod +x ./localstack_bootstrap/sqs_bootstrap.sh.

Add this line to your docker-compose.yml:
- ./localstack_bootstrap:/docker-entrypoint-initaws.d/.
So it could look like this:

Then your queues can be reached by URLs
http://localhost:4566/000000000000/queue1
and
http://localhost:4566/000000000000/queue2.

Further reading:
https://docs.aws.amazon.com/cli/latest/reference/sqs/create-queue.html
https://joerg-pfruender.github.io/software/docker/microservices/testing/2020/01/25/Localstack_in_Docker.html

Similar Posts

LEAVE A COMMENT