'Getting pymongo.errors.ServerSelectionTimeoutError: IP:27017: [Errno 113] No route to host

I'm getting this error when I try to access mongo DB hosted in EC2 from my Python job (ECS)

pymongo.errors.ServerSelectionTimeoutError: 10.133.X.X:27017: [Errno 113] No route to host

Can you guys help me to solve this issue?



Sources

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

Source: Stack Overflow

Solution Source