StartPortForwardingSessionToRemoteHost not working correctly

125 Views Asked by At

I connect RDS via bastionhost with comment:

ssh -i <ssh_key> -f -N -L 5432:<db_host>:5432 ec2-user@<bastion_host_ip> -v

Everything is okey. I can connect to RDS.

But when i use StartPortForwardingSessionToRemoteHost of SSM to connect RDS with command:

aws ssm start-session --target <bastion_host_id> --region ap-southeast-1 --document-name AWS-StartPortForwardingSessionToRemoteHost --parameters "host=<db_host> ,portNumber=5432, localPortNumber=5432" 

It said: Waiting for connections...

But when i connect to rds, It said: Unable to connect to server: connection timeout expired

I Try to restart my pc and reconnect with SSM but not success.

My SSM agent in bastion_host work okey with "StartPortForwardingSession" comment below:

aws ssm start-session --target i-06554e8ff658d4069 --document-name AWS-StartPortForwardingSession --parameters "portNumber=xxx, localPortNumber=xxx" 

My EC2_ROLE is:

  • AmazonSSMManagedInstanceCore
  • AmazonSSMFullAccess Done have error log when connect StartPortForwardingSessionToRemoteHost in: /var/log/amazon/ssm/error.log

Has anyone encountered this problem? Thank for reading...

0

There are 0 best solutions below