I need to set up PostgreSQL db connection for AWS instance. First i need to create a tunnel to the instance. I can do this with AWS CLI and session manager, by running:
aws ssm start-session --target <instanceID> --document-name AWS- StartPortForwardingSessionToRemoteHost --parameters '{"host":["host"], "portNumber":["5432"], "localPortNumber":["5432"]}'
But when I trying to do this in Robot test using boto3 library:
@keyword(name="AWS Start Tunnel")
def start_tunnel(self, instanceID: str) -> str:
ssm_client = boto3.client('ssm')
response = ssm_client.start_session(
Target=instanceID,
DocumentName='AWS-StartPortForwardingSessionToRemoteHost',
Reason='Robot Test',
Parameters={'host': ['host'],
'portNumber': ['5432'],
'localPortNumber': ['5432']}
)
return response
It is creates the session but looks like not connected to it, because I cannot connect to the db. Maybe I need to have a webSocket connection also?
AWS CLI is works. test with boto3 - not.