How to pass connection information between two dependent windows instances during cloudformation?

1

I am doing a lift and shift with software from an on-premises architecture. There are two servers (main and auxiliary) that have to talk to one another over the network. I currently have tested and confirmed that I can manually add their hostnames and private IP address to the hosts file ("C:\Windows\System32\drivers\etc\hosts") and the software works fine.

For those that don't know, this file is used by Windows to map a network hostname like EC2AM-1A2B3C to a IP address. So if I added the hostname and IP address of the main server into the hosts file of the auxiliary server, then the auxiliary server could route to the main server. (i.e. PS> ping EC2AM-1A2B3C would then work).

How could I pass the required information to both servers? They both have to know the other server's private IP address and hostname. If this is not possible at server spin-up time, how might the servers connect and pass this information? I would really like to automate this if possible.

1 Antwort
0

Rather than utilizing the IP addresses mapped to instances in the hosts file you could instead create DNS records for the instances and refer to them for the application if possible. You can create a private Route53 zone in a VPC, add A records pointing to the instances via CloudFormation.

If it absolutely isn't possible via DNS records then you could do it via storing the hostname & IP in parameter store and then fetching it sometime after instance creation to add the host file entries.

beantwortet vor einem Jahr

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen