Can we set easy-to-remember hostnames for EC2 instances?

后端 未结 11 1001
一向
一向 2021-01-29 19:42

I\'m running a couple of standard Fedora instances on EC2. I feel the public hostnames of the instances assigned by Amazon are too weird and hard to remember. I\'d like to chang

11条回答
  •  佛祖请我去吃肉
    2021-01-29 20:35

    You will need to do multiple things to set the hostname:

    1. hostname newname - sets the hostname, but is volatile
    2. edit /etc/hostname - sets the hostname for the next reboot
    3. edit /etc/hosts - to keep sudo from complaining

    I put these together into a script and uploaded it as a gist: https://gist.github.com/mnebuerquo/5443532036af8b48995547e2817dba85

提交回复
热议问题