Linking Amazon RDS with JetBrains DataGrip

I am writing this post for my reference and hopefully it will help others who spent several days trying to get Amazon RDS to work with their DataGrip software.

With numerous Sequel Pro tutorials floating around the web I haven’t found a single one that helped those who use DataGrip. I was reluctant to change as I love JetBrain’s software and was eager to make it work. The same might also apply for those using PHPStorm with the data source function (I haven’t tried it — but if you do let us know).

To do this you won’t need to do any manual tunnelling or anything like that, DataGrip will handle that for you.

Step 1: Click the ‘+’ in the top left of DataGrip and select ‘MySQL’ option

Step 2: For the ‘Host’ add you Amazon RDS endpoint here. You can find this in the RDS section of you AWS platform:

Copy your endpoint as seen above without the port number and colon. (The port number is the four numbers to the right of the colon).

Step 3: The ‘Port’ number is the numbers after the colon. Don’t add the colon in here.

Step 4: For the ‘Database’ you need to add the name of your database. This can be found above the Endpoint on the RDS platform (the other pixelated section in the image above).

Step 5: For the ‘User’ add the username you associated to database when you first set it up.

Step 6: For the ‘Password’ add the password you associated to database when you first set it up.

Once you have done this, your details should look like this:

Step 7: Once you have done that, it’s time to set up the SSH. To do that click the ‘SSH/SSL’ tab located above the ‘Host’ input.

Step 8: Click the ‘Use SSH tunnel’ checkbox to activate the inputs below.

Step 9: For ‘Proxy host’ add the Public IP address associated with you Amazon EC2 instance. You can find it here:

For the ‘Port’ I made this 22

Step 10: For ‘Proxy User’ you need to add the username associated to the EC2 instance when you first set it up.

Step 11: Change ‘Auth type’ to be ‘Key pair (OpenSSH)’.

Step 12: For ‘Private key file’ add the location of your SSH key that you use to log into AWS. For me I made mine my default SSH key, which is located at ~/.ssh/id_rsa

Step 13: The ‘Passphrase’ should be the passphrase associated with the key you used. Leave this blank if you didn’t associate a passphrase with you ssh key.

Step 14: Once you done this, your tab should look like this:

Conclusion: You can test the connection by clicking ‘Test Connection’ or ‘Apply’ button. You should now be able to see and use your RDS database from DataGrip.