ApsaraDB for MongoDB allows you to apply for a public IP address to connect to an instance over the Internet. You can use the console to apply for a public IP address. Allowing access through a public IP address may incur security risks to the associated instance. To ensure data security, you must release public IP addresses in a timely manner when they are not needed.
You can connect to ApsaraDB for MongoDB internally through a VPC or classic network, or externally over the Internet.
|Internal IP address – VPC||
|Internal IP address – classic||Cloud services in a classic network are not isolated. Unauthorized access to cloud services is blocked only by the security group or whitelist policy. For more information about modifying the network type to VPC, see Modify the instance network type.|
|Public IP address||
Note Access to a MongoDB instance through a public IP address may incur security risks. We recommend that you migrate your applications to an ECS instance that is in the same region and has the same network type as the MongoDB instance. Then you can use the VPC internal network.
- Log on to the ApsaraDB for MongoDB console.
- In the upper-left corner of the homepage, select the region of the instance.
- In the left-side navigation pane, click Sharding instances.
- Locate the target instance, and then click the instance ID.
- On the Basic Information page that appears, click Database Connection in the left-side navigation pane.
- On the Database Connection page that appears, click Apply for Public Connection String on the right of Public IP Connection.
- In the Apply for Public Connection String dialog box that appears, select Mongos and click OK.
You can repeat this step to apply for public IP addresses for multiple mongos based on your business needs. You can only apply for another public IP address after the current requested public IP address has been created.
After you obtain the public IP address, you must add it to the whitelist before you can use this address to access the instance. For more information, see Configure a whitelist.
- When the application is completed, the public IP address and its associated connection string URI are added to the mongos in the instance details page. For more information, see Connect to a MongoDB sharded cluster instance.