I have a flask application which needs to interact with an SQS service whenever an endpoint is hit.
I'm mimicing the SQS service locally using docker image sukumarporeddy/sqs:fp
whose base image is https://github.com/vsouza/docker-SQS-local with two more queues added in configuration.
I need to access this service from another app which is run as app_service. These two services are run using docker-compose.yml file where I mentioned two services.
app_service
sqs_service
While building the app image, I'm setting environment variables to access the sqs_service as QUEUE_ENDPOINT=http://sqs_service:9324
. But when I try to access the sqs_service the app, it is saying invalid queue endpoint.
I'm using boto3 to connect to the local sqs_service.
boto3.client('sqs', endpoint_url=os.getenv("QUEUE_ENDPOINT"), region_name='default')
Here's the docker-compose.yml file.
app_service:
container_name: app_container
restart: always
image: app
build:
context: ./dsdp
dockerfile: Dockerfile.app.local
ports:
- "5000:5000"
env_file:
- ./local_secrets.env
command: flask run --host=0.0.0.0 --port 5000
sqs_service:
container_name: sqs_container
image: sukumarporeddy/sqs:fp
ports:
- "9324:9324"
local_secrets.env:
QUEUE_ENDPOINT=https://sqs_service:9324
FEEDER_QUEUE_URL=https://sqs_service:9324/queue/feeder
PREDICTION_QUEUE_URL=https://sqs_service:9324/queue/prediction
AWS_ACCESS_KEY_ID=''
AWS_SECRET_ACCESS_KEY=''
Error that I'm getting when trying to send messages to the SQS service that is running locally.
ValueError
ValueError: Invalid endpoint: https://sqs_service:9324
Where am I making mistake?