I have a Mongo DB server active at a public port and IP. I want to use that server to access my data from a project I have uploaded to AmazonSageMaker Studio Lab. My problem is that, for some reason, I get a connection error
pymongo.errors.ServerSelectionTimeoutError: [myIP]:[myPort]: timed out, Timeout: 30s, Topology Description: <TopologyDescription id: 64662861c3a8cec9e29e9462, topology_type: Unknown, servers: [<ServerDescription ([myIP],[myPort]) server_type: Unknown, rtt: None, error=NetworkTimeout([myIP]:[myPort]: timed out')>]>
The server itself works fine, as I have managed to access that same database from some other third party sources like Google Colab. Is there any reason why my database is not connectable from Amazon SageMaker Studio Lab? And, if so, how can I fix this issue? In case it helps, this is my mongod.conf file:
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
# engine:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1,0.0.0.0
# how the process runs
processManagement:
timeZoneInfo: /usr/share/zoneinfo
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:
I also have the authentication set for this database in my docker compose file, but even with the correct connection string, amazon SageMaker is not able to accesss the said database while other third party elements like Google Colab can:
version: "3"
services:
mongo-db:
container_name: mongo-db
image: mongo:4.4.18
environment:
MONGO_INITDB_ROOT_USERNAME: [USERNAME]
MONGO_INITDB_ROOT_PASSWORD: [PASS]
volumes:
- ./mongo_data:/data/db
- ./mongod.conf:/etc/mongod.conf # mount the custom mongo configuration file
ports:
- 27027:27017
restart: always