Amazon EC2 hostnames

2019-07-19 12:01发布

问题:

I am trying to configure WAS 8.5 on EC2, but what I find is that the EC2 hostname changes on each restart. So basically, I've created a WAS instance on ec2-54-200-56-168.us-west-2.compute.amazonaws.com, and then after restart the server (and IP of course) changes to ec2-54-200-55-7.us-west-2.compute.amazonaws.com

Of course WAS needs the hostname in its cell configuration. But also, if the host names keep changing I don't understand how to set up two servers to talk to each other.

回答1:

You can associate an Elastic IP with your EC2 instance. This will give it a fixed IP address, as well as a public DNS that doesn't change after restart.



回答2:

The solution from David is not correct. The Elastic IP (and hostname) change in EC2 Classic (non VPC), so it won't do the trick. The IP/hostname with EC2 classic will change after each stop/reboot.

The only solution I think would work is to use the VPC, and then use an Elastic IP, which persists for the lifetime of an instance.