DNS changed on aws when chef server instance was restarted


I have an issue with my chef server, because i turned off my instance in aws and turned it back on, so the dns changed, also i reconfigured my chef server, wrote knife ssl fetch and check and it worked, but when i´m going to upload the cookbook, appears the following:
Thanks in advance.


And… of course the DNS changed, because EC2 instances are normally assigned dynamic addresses out of a pool managed with DHCP. If you want stable hostnames in DNS, there are several common ways to do this. One is to setup an AWS hosted load balancer, with access restricted to your relevant VPC or IP address ranges as based on your AWS configuration. Another is to buy a stable IP address inside that your VPC that that server can use, and hardcode that. Another, and quite common place approach, is to set up a DNS CNAME, even a Route53 CNAME if desired, to be automatically updated when that server is rebooted or rebuilt.

And if you are really insistent on using chef tools to manage this, you can do what I do for testing environments: Set up a “chef-solo” git repo that has bootstrap tools, such as hostname resetting scripts and chefdk installers, with a very simplified role that can be run with “chefos-lo -o ‘role[chef-server-init]’” and set up /etc/hosts on the chef server itself, just to help bootstrap systems.

Each has its trade-offs.


You’d better got an elastic IP from AWS and also change your host name to a more user friendly one. Then attach that EIP to your server. After that, your hostname will be tied to this EIP even you reboot your server.