0

I'm attempting to access an AWS RDS instance within the VPC through a bastion host. I can run the following command successfully which opens up a proxy. I then point my local database management software at localhost:63333 and successfully connect to the database server:

ssh -i key.pem -N -L 63333:my-db.rds.amazonaws.com:5432 ubuntu@my-bastion.ec2.amazonaws.com -v

The output shows a message that indicates localhost:63333 is open:

debug1: Local forwarding listening on 127.0.0.1 port 63333.

I'm attempting to use a config file to generalize but am having issues. I based my files on this post. My config file:

Host bastion
  Hostname my-bastion.ec2.amazonaws.com
  User ubuntu
  IdentityFile key.pem
  Localforward 63333 my-db.rds.amazonaws.com:5432
  LogLevel VERBOSE

Host database
  Hostname my-db.rds.amazonaws.com
  User ec2-user
  IdentityFile key.pem
  ProxyJump bastion
  Localforward 63333 my-db.rds.amazonaws.com:5432
  LogLevel VERBOSE

(I tried using localhost for the Localforward keys per the post in addition to the configuration above.)

This runs with no errors but the localhost does not open.

How to replicate the ssh command in the config files?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.