Created
November 14, 2016 20:45
-
-
Save mauricios/4ed107d5e1d7c67379b702c7cc4ac17c to your computer and use it in GitHub Desktop.
AWS EC2 User Data setting hostname
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
apt_upgrade: false | |
preserve_hostname: true | |
runcmd: | |
- hostname "Hostname-`ec2metadata --instance-id`" | |
- echo "127.0.0.1 Hostname-`ec2metadata --instance-id`" >> /etc/hosts | |
- echo "Hostname-`ec2metadata --instance-id`" > /etc/hostname |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment