Member-only story
Send messages to SQS during Localstack initialization
The Docker containers have disposable nature. Personally, when using SQS on a Docker container locally for tests I don’t like to send messages to SQS each time container is initialized. In this tutorial, I will show how to initialize SQS with messages in it.

The complete source code can be found below
For convenience to spin up a container with SQS docker-compose is used. The definition file:
The definition file is very simple it uses a Localstack image to spin a container with SQS service in it. It also defines volumes. One for the bash script and another for files with messages. Each time container is created and all services of a Localstack are ready all scripts inside the first volume are executed. More about this can be found below:
The first volume has one bash script:
This script creates a profile that is used in the following commands, creates SQS, puts a single message to a queue, puts a single message to a queue from a file, located in the second volume, puts two (can be more) messages to a queue in batch…