Reputation: 633
If I have to make a call to another EC2 in my VPC then I will need either its IP address or private DNS name
But if second EC2 needs to be replaced then I will have to update first EC2 as well
So what is the best way to do so.
Also what is a good use case for this scenario
Upvotes: 0
Views: 44
Reputation: 269101
A good practice is to use DNS names to refer to other instances rather than their IP address. This way, the instances can be substituted without having to update the reference.
server1.internal
)The instance that starts could even call Route 53 and register itself. For example, when it starts if it knows what it is (eg an accounting system), it can register itself as accounting.internal
. If that instance fails and another starts up with the same startup code, the new instance would update the DNS entry to point to itself.
Upvotes: 1