#Network Egress - MongoDB Atlas

29 messages · Page 1 of 1 (latest)

versed horizon
#

Hi there! I have a MERN app and I have set up my DB in mongoDB Atlas, I started to see egress cost are going high $25 so far for this month. My average payments in previous months were around $4 (Hobby waived plan)

My question is, how could I reduce this cost? Would I need to set up a mongoDB database in railway itself to avoid these costs?

mental riverBOT
#

Project ID: 32d3d99f-a53d-4484-8c73-dbb077d6b557

ashen jungleBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

versed horizon
#

32d3d99f-a53d-4484-8c73-dbb077d6b557

meager summit
#

If mongo is the only thing you're sending data to, then moving the mongodb to railway can remove those egress costs if you take advantage of the internal network. Of course, you'll have to compare that with the cost of hosting the db, so it could also end up costing more. You should take a look at railways pricing and compare it to the current operating cost

#

And, it must also be possible to use the private network. If users are communicating to the database directly over internet (for whatever reason) then the egress costs will increase, which will only worsen the situation

versed horizon
#

For this internal network, Would I need to create a DB as a new project?

meager summit
#

No, it needs to be a service within the same project. If it is in a different project, there wont be a private network connection to rely on

versed horizon
#

If I have multiple environments within a project. Could I create it as new env? Or I'd need to have one service for each env?

meager summit
#

I'm not sure, i dont really use the environment feature. I'll see if i can find it in the docs

#

It looks like if you create a new environment for this, it will automatically add the service to all environments. I believe you're looking for the "Fork environment" feature, where that doesn't happen, and your changes are easily discarded

#

Oh nevermind! I read it wrong!

#

Your changes will apply to all environments regardless:

At this moment only changes in environment variables can be merged, but we are working on adding support for any other changes made to a service or plugin.

static axle
#

a little extra clarification, the private networks are per environment within a single project

versed horizon
#

So to be clear, I would need one mongoDB service per environment?

static axle
#

environments are identical is most ways, you create a database in the production environment and one will be created in all other environments automatically, though you are responsible for cloning the data across the multiple databases

versed horizon
#

There's one thing I'm not clear about. If I connect my app to my MongoDB database using MONGO_PRIVATE_URL variable and the data gets saved there. How can I access or check this data? I was trying to do that by using MONGO_URL variable in Mongo Compass but I don't see the data created

static axle
#

make sure you are connecting to the same database within mongo

brazen oracle
#

Hello! I'm wondering the same thing. I have deployed my railway service in us-east4 – and I created a dedicated MongoDB cluster on GCP us-east4. Would the data transfer between Mongo and my railway service would count as external egress?

rapid cargo
#

Yes

brazen oracle
#

Is there any work around for that?

#

(I do not want to manage MongoDB myself for the production env, and I want to use Atlas – but the services query a lot of data from mongo and the egress bill would be massive if it's not handling thought a private network)

static axle
#

connect to the database with its MONGO_PRIVATE_URL variable, there is zero egress fees for traffic flowing across the private network

rapid cargo
rapid cargo
static axle
#

oh shit my bad

#

what adam said

brazen oracle
#

Damn, but is the MongoDB railway database option production ready? (I doubt)