How to use an SSH tunnel and MySQL Workbench to connect to a MySQL instance that uses an AWS public EC2 instance?

Sep 27, 2021·

1 min read

  1. Open MySQL Workbench.

  2. Select MySQL New Connection and enter a connection name.

  3. Choose the Connection Method, and select Standard TCP/IP over SSH.

  4. For SSH Hostname, enter the public IP address of your EC2 instance.

  5. For SSH Username, enter the default SSH user name to connect to your EC2 instance.

  6. Choose SSH Key File, and select the .pem file used to connect from your file system.

  7. For MySQL Hostname, enter the database endpoint name.

  8. For MySQL Server Port, enter the port number that you use to connect to your database.

  9. For Username, enter the user name that you use to connect to your database.

  10. For Password, enter the MySQL user password.

  11. Choose Test Connection. After the test is successful, choose OK to save the connection.

After the connection is configured, you can connect to your private RDS DB instance using an SSH tunnel.

(Excerpted from AWS Q&A)