edit-icon download-icon

Connect to ApsaraDB for MongoDB from a Windows ECS instance over the Internet

Last Updated: May 14, 2018

To connect to ApsaraDB for MongoDB over the Internet, it is recommended that you use the public network address. For details, see Obtain Internet URL.

You can also use the mapping method to connect to ApsaraDB for MongoDB from a Windows ECS instance over the Internet. Details are as follows:

  1. Log on to the Windows ECS instance and run the following command in the CLI:

    1. netsh interface portproxy add v4tov4 listenaddress=ECS instance public IP address listenport=3717 connectaddress=Connection address of ApsaraDB for MongoDB connectport=3717

    To view all port forwarding rules, run the following command: netsh interface portproxy show all

  2. Verify the connection.

    On the local MongoDB shell, connect to the Windows ECS instance and read or write data. For example, if the IP address of the ECS is 1.1.1.1, run the telnet 1.1.1.1 3717 command.

    Now your local PC or server can connect to ApsaraDB for MongoDB through port 3717 of the ECS over the Internet.

    Note:

    • portproxy is provided by Microsoft and is not open-sourced. If you have any questions regarding its usage, see usage instructions of netsh portproxy or consult Microsoft.
    • You can also use other methods. For example, use portmap to configure mapping.
  3. After finishing related operations, you can run netsh interface portproxy delete v4tov4 listenaddress=ECS public IP address listenport=3717 to delete the public network forwarding rule.
Thank you! We've received your feedback.