Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native SSH tunnel over AWS SSM #9107

Closed
ghost opened this issue Jun 25, 2020 · 14 comments · Fixed by #30000
Closed

Native SSH tunnel over AWS SSM #9107

ghost opened this issue Jun 25, 2020 · 14 comments · Fixed by #30000

Comments

@ghost
Copy link

ghost commented Jun 25, 2020

Is your feature request related to a problem? Please describe.
Currently, I'm connecting to my RDS instances through jump hosts over AWS SSM. Since there's no AWS SSM support yet on dbeaver, I'm creating the SSH tunnel separately on terminal, and then on my dbeaver connection settings, I connect to the databases on localhost. This is far less than ideal and not scalable when working with multiple databases and drivers.

Describe the solution you'd like
I would like a native support for SSH tunnel over AWS SSM.

Describe alternatives you've considered
Perhaps having dbeaver to read from local ssh config? That way we could still make use of ProxyCommand to invoke aws ssm to start a session.

@uslss
Copy link
Member

uslss commented Jun 26, 2020

thanks for suggestion

@ghost
Copy link

ghost commented Jun 24, 2021

The solution to this doesn't need to be as complex as supporting AWS SSM. SSM already supports SSH, so all DBeaver needs to do is allow the use of the native SSH agent. On macOS for example my ~/.ssh/config is all setup and working for SSH to proxy via SSM, so if DBeaver used that everything would just work. Alas, unfortunately it doesn't.

@etiennecaldichouryatnapta

Very interested also :)

@vrcollins
Copy link

I am very interested in the AWS SSM feature.

@n1ngu
Copy link

n1ngu commented May 6, 2022

DBeaver using the system-wide SSH setup would benefit from all the SSH tooling (ssh-agent, ssh_config, known_hosts, etc) and the feature here requested would be available for free.

I am lacking some context on why DBeaver uses its own separate SSH stack. I'd be interested in the topic if anyone can share some links.

@bober2000
Copy link

bober2000 commented May 31, 2022

Will add, that AWS SSM SSH tunnel, also, makes possibe to connect to DBs that located in private subnets with no need to create bastion host in public. So yes - we are waiting for this feature too

@ArturV93
Copy link

Any updates?

@chaodhib
Copy link

This feature would indeed be great

@bm-jacob
Copy link

bm-jacob commented Mar 9, 2023

You can use your existing SSH config for SSM just fine with DBeaver, simply open an SSH tunnel with the proper ports:

ssh [SSM-PROFILE-NAME] -L 5432:[RDS_SERVER_ADDRESS_IN_AWS_PRIVATE_SUBNET]:5432

Then connect to your localhost port 5432 to access your AWS RDS instance behind SSM

@n1ngu
Copy link

n1ngu commented Mar 9, 2023

simply open an SSH tunnel with the proper ports

@bm-jacob Obviously you can do that. We are speaking about using SSM within network profiles manged by DBeaver.

@Fydon
Copy link

Fydon commented Sep 5, 2023

Although you can't use SSM or EC2 Instance Connect in the SSH tab, you can use Shell Commands to setup SSM or EC2 Instance Connect and then tunnel through that. With this the entire connection will be handled within DBeaver, but managing this through the SSH tab directly would be greatly preferable. For instance, this workaround probably works best with unique ports for tunnels to different instances and every instance is identified as localhost so you either have to select Bypass host verification (under Advanced settings on the SSH tab) or manually check the host every time you connect to a different instance.

image

image

@Rah1x
Copy link

Rah1x commented Feb 5, 2024

Here is how ive got it done without using "Before Connect" shell script and instead manually doing shell yourself:

  1. Step 1 (shell) = SSO Login via shell (assuming sso profile already configured):
    aws sso login --profile {loremIpsumProfile}

  2. Step 2 (shell) = Create a remote host tunnel via same shell you logged in at step 1:
    aws ssm start-session --target {loremIpsumTarget} --profile {loremIpsumProfile} --document-name AWS-StartPortForwardingSessionToRemoteHost --parameters '{"portNumber":["22"],"localPortNumber":["9999"],"host":["loremIpsumHost"]}'

  3. Step 3 (dbeaver) = SSH into the tunnel via dbeaver. For this, use localhost and 9999 in the ssh tab.

@Fydon
Copy link

Fydon commented Feb 5, 2024

As a follow up to my previous comment, to get around needing to use bypass host verification enter a unique host name for each instance that maps to 127.0.0.1. This can either be performed in the hosts file or by using a service that maps DNS names to IP addresses, e.g. db.127-0-0-1.nip.io.

@arhayka arhayka added this to the 24.0.5 milestone Mar 8, 2024
@serge-rider serge-rider self-assigned this May 7, 2024
@serge-rider serge-rider linked a pull request May 8, 2024 that will close this issue
@arhayka arhayka added the wiki label May 9, 2024
@Matvey16 Matvey16 self-assigned this May 10, 2024
@serge-rider
Copy link
Member

Native AWS SSM tunnels support will be added in DBeaver 24.1 (PRO products). Unfortunately it is not possible to add this feature in Community (one of the reasons is dependency on AWS SDK and AWS CLI).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment