Skip to content

Instantly share code, notes, and snippets.

@brian-lc
Created September 25, 2012 16:04
Show Gist options
  • Select an option

  • Save brian-lc/3782794 to your computer and use it in GitHub Desktop.

Select an option

Save brian-lc/3782794 to your computer and use it in GitHub Desktop.
Attempt to set a hostname in the /etc/rc.local file of an AMI instance. I could not get it to work...
# AMI EC2 /etc/rc.local snipit I could not get to work
META_HOSTNAME = `ec2-describe-tags --filter "resource-type=instance" --filter "resource-id=$(ec2-metadata -i | cut -d ' ' -f2)" --filter "key=Name" | cut -f5`
hostname $META_HOSTNAME
@brian-lc

Copy link
Copy Markdown
Author

Works when run manually, when part of the /etc/rc.local file id did not seem to work. Possibly a permissions issue or ec2 env vars issue...
Setting...
hostname '<the_host_name>'
Worked just fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment