Unable to access to Postgres Using Boundary CLI

Hi ,

Today have tried to access the postgres DB using boundary CLI but getting below error .

boundary connect postgres -username=postgres -target-id ttcp_aAO2Zc4nqQ -token at_BsscGY21fV_s12C8p7vC2CPmDfKhXMAvp9wyk2dFt1tEFrfnjW83AYnZj5KUAXtr2tfEKU1xERivNhRTq7JfVSgrJNJZyhojEGCn26Jfgow4ft97yuB3hzdRe6o1K6cgU2GYHpwS42iFPqiPkpz
Password for user postgres:
psql: could not connect to server: Connection refused
Is the server running on host “” and accepting
TCP/IP connections on port 40787?

Have used the Git Terraform Repo available and have created infra for Boundary as per the Terraform code and there are two controllers , 2 workers and 1 private subnet instance as target .

Have tried to access the Target using ssh able to access it but have installed the postgres on same target have enabled the port 5432 but not able to access . Please help …

So you can access the Postgres host through boundary connect ssh, or just through regular SSH directly to it?

Yes able to access the same private host using the ssh but have installed postgres and trying acces it as per shared command in recently it’s like

boundary connect postgres …

Not able to access it .

I am using your hashicorp-reference-boundary repo of gitHub . If any new recent updated boundary implications is available then please share the reference.

If it’s not already, try setting the maximum connection count for the target either to -1 for unlimited, or some number larger than 1. I’ve seen in the past where Postgres requires multiple connections to open a session. If the allowed connection count is 1, then it can’t connect successfully.

Yes it’s working able to connect Postgres , Thanks

Can help to how can i connect to Mongodb and what will be command

One more thing can i get the session logs to trace in case of any issue

There’s no helper for MongoDB that I know of, but I think there have been some past threads here on connecting to MongoDB with Boundary.