Here is how I resolved it.
NOTE: I was using AWS EC2 instance to configure this,So this solution
will work only on AWS. Not sure about Azure or GCP or on-prem.
I have 2 windows servers.
- VPC Range: 10.0.0.0/16
- Server 1: 10.0.0.1
- Server 2: 10.0.0.2
Once the cluster has been configured I have set the cluster IP as
Then configured SQL Server Listener. Its a single subnet listener.
Now, Just take a look at this Doc.
By default all the routes are going to via 10.0.0.1. While trying to connect the cluster, I just oped the all traffic to the 10.0.0.0/16 on the both server's security group. For listener it'll try to search the 10.0.0.4 on AWS side, but none of the instances had this IP.
As per my understanding It'll try to lookup on the AWS network level. So I have added the secondary IP to the current master, then it worked. But during the failover again it'll fail. So I used multi subnet.
Primary is in Subnet 1, secondary is in Subnet 2. Then while creating the listener it'll ask 2 IP addresses.
EG:
- Subnet 1: 10.0.0.0/24
- Listener IP: 10.0.0.4
- Subnet 2: 10.0.1.0/24
- Listener IP: 10.0.1.4
Then attached the 10.0.0.4 as a secondary IP for Server 1, 10.0.1.4 for Server 2.