MASTER_ADDR needs to be a routable IP for all processes in the group. If the question is how to get that IP and share it with other processes, the cloud service provider might know better? I would imagine this is common problem that would occur when configuring many distributed systems (e.g., IP of the master node in a Hadoop cluster).
If the hostname is pre-known, I guess all processes can try to resolve that hostname and pass the resolved IP to MASTER_ADDR?
BTW, could you please add a “distributed” tag to distributed-training related questions, so that people working on it can get back to you promptly.