简体   繁体   中英

AWS SSM port forwarding not working - using newest SSM agent

Created new EC2 instance and SSM agent is installed on it. I can connect with SSM to EC2 instance using:

aws ssm start-session --target i-0xyz

But Port Forwarding does not work - tried:

aws ssm start-session --target i-0xyz... --document-name AWS-StartPortForwardingSession --parameters '{"portNumber":["3306"],"localPortNumber":["3306"]}'

Got results:

Starting session with SessionId: xyz-0xyz
Port 3306 opened for sessionId xyz-0xyz.

Then used MySql Workbench on my computer and tried connecting - in terminal it came:

Connection accepted for session xyz-03abc...

But MySql Workbench never connected - it keeps 'spinning' and never actually connect. Tried several times with different EC2s as well..

This is a version of SSM on my computer:

ssm session-manager-plugin --version
1.1.61.0

Tried reinstalling SSM agent both on my computer and on EC2 with Newest version - did not work. What can I try next?

This seems to me that your MySQL is rejecting the remote access from your localhost or anywhere that you are trying to connect from.

You need to grant the access for that MySQL user.

GRANT SELECT ON *.* TO 'user123'@'%';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM