How to Solve LocalStack Always Connecting To LocalHost
I have LocalStack in my local machine for resolving AWS service dependencies. I am trying to test my application which connects to the LocalStack SQS. I have deployed my application as a docker container. The problem is when I am accessing SQS getQueueUrl from my application container, it is giving me localhost as AWS endpoint. But I mentioned my local machine's private IP while setting up Java SQS client.
The problem is that LocalStack does not override hostname property. So while initializing LocalStack, we need to define HOSTNAME_EXTERNAL field in docker-compose.yml file of LocalStack. It would be somewhat similar to below:
Once you define proper hostname or IP address in HOSTNAME_EXTERNAL field and start LocalStack , that should solve the problem.