TL;DR
DocumentDB in another region <-------- ec2 instance in another region
access
So AWS has launched MongoDB as a service and calls it DocumentDB.
Currently the supported regions are:
1. N. Virginia
2. Ohio
3. Oregon
4. Ireland
So according to their documentation, to access the documentDB:
To interact with your Amazon DocumentDB cluster, you must launch an Amazon Elastic Compute Cloud (Amazon EC2) instance into your default VPC, in the same AWS Region where you created your Amazon DocumentDB cluster.
I did this and it works as expected.
The problem is, how do I access this from another ec2 instance on another VPC, security group and another region.
I tried to access it and this was the exception:
pymongo.errors.ServerSelectionTimeoutError: ....
[Errno 113] No route to host
Note: The above works if I launch an ec2 instance within the same region and same security group.
Is there something I can do to whitelist the ec2 instance in another region using firewall settings?
AWS documentdb troubleshooting guide here answers this exact question;
I solved the same issue with VPC Peering (as described in the article)
Have you looked into vpc-peer-region-example documentation by AWS?
Seems like the architecture mentioned in (doc) is perfect fit for you. It shows how to use a combination of VPC peering and AWS PrivateLink to extend access to private services to consumer in different region (and different vpcs).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With