远程数据库上的PHP mongoDB SSH隧道

I am using mongoDB with PHP. on local system it works fine. Now I am trying to access mongoDB cluster on AWS which is secured by SSH. I am using below code

$conn = new MongoClient('mongodb://SSH Hostname', [
        'username' => 'username',
        'password' => '',
        'db'       => 'DBname'
        ]);

print_r($conn);

It gives below error

Type: MongoConnectionException

Message: Failed to connect to: SSH Hostname :27017: Connection refused

I can connect DB from MongoDB compass or Studio 3T. How I can use SSH while connecting using PHP