- find end points:
1. AWS RDS mysql database endpoint: leo-mysql.abcde12222.us-east-1.rds.amazonaws.com 2. AWS RDS proxy end point: ddd-accesss.proxy-abcde12222.us-east-1.rds.amazonaws.com - set a jump box
Host mm-myjump HostName 54.70.111.222 User ec2-user IdentityFile ~/.ssh/NOC.pem ServerAliveInterval 60 ServerAliveCountMax 3 LocalForward 3333 ddd-accesss.proxy-abcde12222.us-east-1.rds.amazonaws.com:3306 LocalForward 3311 leo-mysql.abcde12222.us-east-1.rds.amazonaws.com:3306 - check whether a TCP port is reachable.
ssh mm-myjump nc -zv leo-mysql.abcde12222.us-east-1.rds.amazonaws.com 3306 nc -zv ddd-accesss.proxy-abcde12222.us-east-1.rds.amazonaws.com 3306Test result: see connected and it is good.
- find ips of proxy
getent hosts ddd-accesss.proxy-abcde12222.us-east-1.rds.amazonaws.com 10.32.111.222 vpce-0d550c1ebeb3a6159-jq0x2yyd.vpce-svc-0a3de4cabd09a2ae4.us-east-1.vpce.amazonaws.com ddd-accesss.proxy-abcde12222.us-east-1.rds.amazonaws.com 10.32.888.999 vpce-0d550c1ebeb3a6159-jq0x2yyd.vpce-svc-0a3de4cabd09a2ae4.us-east-1.vpce.amazonaws.com ddd-accesss.proxy-abcde12222.us-east-1.rds.amazonaws.com - find ip of jump box
10-16-222-888 - set allow host for the user and test
# connect to data base end point directly, only need 10.16.%.% mysql --host='127.0.0.1' -P 3311 --user=tester --password='test12233*' -A revenuewireDW SELECT USER(), CURRENT_USER(); # connect to data base proxy, only need 10.32.%.% (becuase db think the host is from proxy. #Also will not match exactly to end point ip. Therefore, use wild cat here). Also need to set #user name and password in secret manage for this option. mysql --host='127.0.0.1' -P 3333 --user=tester --password='test12233*' -A revenuewireDW SELECT USER(), CURRENT_USER();
Sunday, 23 August 2026
Connect AWS RDS using port forward
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment