This topic was automatically generated from Slack. You can find the original thread here.
Hi, guys! Any example / tutorial of MongoAtlas and Bastion Server to avoid 0.0.0.0 firewall rule?
This topic was automatically generated from Slack. You can find the original thread here.
Hi, guys! Any example / tutorial of MongoAtlas and Bastion Server to avoid 0.0.0.0 firewall rule?
Hi , do you need help setting up the bastion server, or do you already have one, and just need help connecting through that from Pipedream?
I have an example on how to create the Bastion Server here: Network / IP range which I will follow now. But in this article there are examples for MySQL and PostgreSQL only, not for Mongo DB.
thanks, just testing with a Mongo Atlas server and developing a workflow template for you
Oh! Thanks a lot!
I’m unfortunately still getting a timeout trying to connect to my test DB through our bastion host, but give this a try: https://pipedream.com/new?h=tch_3egfjq
I realized one of our customers has had issues with this in the past, and tried to connect with the Mongo team here: Node.js tunneling to MongoDB Atlas replica set via bastion host - Installation & Upgrades - MongoDB Developer Community Forums
if this doesn’t work, you may need to consult them on the proper configuration, or try another Node.js client like Mongoose
I’ll give your workflow a try. However, how do I enable this “SSH (Key-Based Auth) Account” to appear in my Mongo DB step? It doesn’t show on mine…
if you add this in the props
section of your code:
ssh: {
type: "app",
app: "ssh"
},
and click the Refresh Fields button at the top of the code, you should see the option to connect an SSH account
Cool!
here’s a little more detail on how to connect any app to a code step: Connecting apps in Node.js
can you paste the content of the file into that field? You can also enter any random string in that field, then:
pem
file as an attachment in that workflowimport fs from "fs";
const privateKey = fs.readFileSync(steps.trigger.context.attachments["your_key.pem"]).toString();
const { host: sshHost, username: sshUsername } = this.ssh.$auth
const ssh = new SSH2Promise({
host: sshHost,
username: sshUsername,
privateKey,
})
That pulls the privateKey
from the contents of the pem attachment, instead of referencing the private key from the connected account
(Workflow attachments are encrypted at rest and private to your account)
Yeah, . Got stuck at the same point as you: timeout. I will research the articles you mentioned. Thanks a lot for all your help!
Let us know if you find out anything useful from the Mongo team! If you get it working, I’m happy to add this as a template in the public docs
Yes, I will! Cheers!