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

后端 未结 11 997
一向
一向 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:26

    Another way is to simply edit ~/.bashrc and prepend PS1 with the nickname of the machine.

    Edit: perhaps more correctly, machine-wide, e.g. on the AWS Linux AMI (an example) (paste this into console or add to your arbitrary install .sh):

    cat << EOF | sudo tee /etc/profile.d/ps1.sh
    if [ "$PS1" ]; then
      PS1="[\u@myinst1:\l \t \! \W]\\$ "
    fi
    EOF
    

提交回复
热议问题