Connect mysql and mongo db running in VM in aws from node container which is running in different VM

Expected behavior

Actual behavior

sucessful connection from containers to DB

Additional Information

I have 2 containers angular an node running on AWS virtual machine, and my database mongo and mysql is running on different virtual machine in AWS

I want to connect mysql and mongo from node container,anything i need to care of