How to configure HA setup in AWS using Hive.

The iraDialer/iraCPA run on a HA framework called Hive. When one instance discovers another instance, it automatically become a HA setup. If no other instance is discovered, the programs operates in standalone mode. There is no switch to specify HA or non-HA. Instead, it is done via configuring Hives to that effect. 

Basically, it is all about service discovery. If you have multiple instances of iraDialer, you can choose whether to put them in HA or non-HA, by configuring the service discovery. The service discovery is done via REDIS or Multicast. Since AWS doesn't support multicast, we will only discuss the REDIS option here.

If you want more than one EC2 instance to be part of one HA cluster, they should be configured to be part of the same Hive. A hive is configured using unique_hive_name field in the redis.json file. If one or more EC2 instance are using the same unique_hive_name and are pointing to the same REDIS database, then the instances will find each other (service discovery) via common REDIS database.
A typical redis.json file: (typically found in /opt/epi/conf directory)

{
    "unique_hive_name" : "aec_test_hive_1",
    "redis_hostname": "localhost",
    "redis_port": 6379
}

The above file can be automatically generated from serverdetails.json file if it is provided at start time.

Question: What if two EC2 instances are using the same hive name, but pointing to different REDIS databases, like the local REDIS?
Answer: Then the EC2 instances cannot discover each other since they don't have a common REDIS database. These will run like standalones. In fact, if you are using cloud licensing, only one instance will run as standalone. The other won't run because of hive name conflict. Always use different hive name for each HA cluster.

Question: What if two EC2 instances are using different hive name, but pointing to same the REDIS database? 
Answer: Then the EC2 instance cannot discover each other since they are in different hives. These will run like standalones.