'Enable Mongo free-monitoring on a AWS EC2 instance?

I'm trying to enable the MongoDB Free Monitoring on an EC2 instance, but I got the error:

Unable to get immediate response from the Cloud Monitoring service. We willcontinue to retry in the background. Please check your firewall settings to ensure that mongod can communicate with "https://cloud.mongodb.com/freemonitoring/mongo"

I suspect mongod can not communicate with https://cloud.mongodb.com/freemonitoring/mongo because of firewall restrictions, but I can find what to allow at AWS to make this work while keeping it secure.

For information, the server has no public IP address, but the firewall rules allow anything to go out.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source