These Scripts change the OS level hostname of an AWS instance to a value supplied via a tag. There is an enclosed script for RHEL Linux (bash) and for Windows (powershell) in this repository.
** Each script leverages the AWS CLI tools to grab the tag from within the instance itself
** This script assumes the AWS CLI tools are not installed and will therefore install them using pip. This will require Python, which for the Windows script will also be installed (script assumes your Linux distro already has Python)
** Also, please be aware that if you run this in an enterprise, you will need to set your proxy settings accordingly as this script requires internet access (you could of course modify accordingly if you want to curl the artifacts from your local web server)
- Using an IAM policy, you should privilege an account in AWS which can read tags from an AWS instance. Privileges greater than this aren't required
- It is assumed that Python is installed on your Linux instance
- You should have a tag on your AWS instance which supplies the hostname. In my case, the tag is called "Name."
- A reboot should occur on your instance after the script runs
- Constants in these scripts should be changed to suit your environment
As there is always some level of risk assumed when executing a script, please take precautions such as backing up/ snapshotting your hosts before running these scripts. My environment these were run on were RHEL 7.0 and Windows Server 2012 R2. I will not be held responsible for any harm encountered ignoring this disclaimer