Created
August 16, 2022 05:59
-
-
Save antoniomaria/8d09e5acdb1c2bc2ecb715586466a0b1 to your computer and use it in GitHub Desktop.
SSH Tunnel to AWS RDS or Aurora DB instance via EC2 instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Verify that you have access to your ec2 instance which has access to DB | |
ssh -i mykey.pem ec2-user@EC2_IP_ADDRESS | |
# Use tunnel port forwarding | |
ssh -i mykey.pem -L 3306:RDS-HOST-NAME:3306 ec2-user@IP-ADDRESS | |
# Connect to localhost | |
mysql -h 127.0.0.1 -P 3306 -u admin -p12345678 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ensure that you don't have a local mysql instance running in the same port
lsof -i :3306