I have deployed 3 MongoDB nodes(node-1, node-2, node-3) in AWS. The
first two nodes (node-1, node-2) are deployed in Virginia region and
the third node(node-3) is deployed in Oregon region and enabled VPC
peering and the replication is working fine . But, Now if the Virginia
goes down the third node(node-3) is still in Secondary. I have to
manually make the node as Primary. Is there any automated way or
alternate solution to do this.
Yes, As per MongoDB Blog documentation here
MongoDB Atlas ensures high availability with a fault-tolerant and self-healing architecture. Replica set members are distributed across availability zones in a customer’s selected region; should a node fail, the election and failover process happen automatically without intervention. You can also choose from
41 regions across
GCP, ensuring that your managed databases are in close proximity to your application servers for minimal geographic latency.
You can deploy across multiple regions for better availability guarantees, meaning that replica set members in additional regions will participate in the election and automated failover process should your primary fail. Note that you can also select your preferred region; this is the region where reads and writes will default to assuming that there are no active failure or failover conditions.
You can also deploy read-only replica set members. Read-only replica set members allow you to optimize for local reads (reduce read latency) across different geographic regions using a single MongoDB deployment. As the name suggests, these replica set members will not participate in the election and failover process and can never be elected to a primary replica set member.
For further your ref here and here