I'm having several
ec2 independent instances(staging and production). They do not talk to each other in any way.
Is is safe to modify
/etc/hostname for better clarity of what instance you've logged in?
Short answer: Yes.
Whenever you need to resolve a hostname to an IP address, you use one of a group of options. This is configurable through
The only name in
If you change the hostname on a machine, all you can do is change what name it thinks it has. Every other host will still get the same name-to-IP mapping. You can't change Amazon's DNS entries.
This is why if you want a valid name, you'll need to set up a CNAME in a DNS zone you control.
If you don't mind that you'll only see the change on the local host, go ahead and change that hostname. The only reason to make a machine's 'personal' hostname (what it thinks it's called) match its 'real' hostname (what everyone else thinks) is to reduce cases of sysadmin insanity.
The single-hostname thing breaks down somewhat when you get more complex setups, too: since a hostname corresponds to an IP, what do you do when you have load balancing or multihomed servers? In the end the whole concept of a local hostname is mainly for convenience and easy of administration.
P.S. You should probably change the hostname and FQDN through the distro's provided mechanism for doing so, as samarudge's linked question mentions. That'd be different for each distro, but happens to be