Setting Hostname on EC2 Instance Spinup


#1

Hello, I’m running into an error while bootstrapping an instance with Chef.

I want to set the hostname of the box to something like www01 with domain
example.com’, and I’m currently setting the hostname with a user data script
but I’m having issues getting chef to recognize the changes (even after a
restart before the knife bootstrap).

What is the recommended way to set a hostname on EC2 (and domain) and then
bootstrap the instance?

Thanks,

  • Chris

#2

On Monday, April 4, 2011 at 9:23 PM, chef@chrisstreeter.com wrote:
Hello, I’m running into an error while bootstrapping an instance with Chef.

I want to set the hostname of the box to something like www01 with domain
example.com’, and I’m currently setting the hostname with a user data script
but I’m having issues getting chef to recognize the changes (even after a
restart before the knife bootstrap).

What is the recommended way to set a hostname on EC2 (and domain) and then
bootstrap the instance?

Set the node name explicitly when you bootstrap the instance with knife (the -N option). Then you could use chef configure the hostname on the box.


Dan DeLeo