Thursday, September 10, 2015

Chef: "ec2" node attribute missing

You can get the ec2 node attribute by creating ec2.json file. Once the node is bootstrappped all of your ec2 metadata will be available in ohai!

a. Linux
            $ touch /etc/chef/ohai/hints/ec2.json

b. Windows
$ mkdir C:\chef\ohai\hints
$ copy /y nul  C:\chef\ohai\hints\ec2.json


========================================================================
In the case that you are using chef-provisioning to provision and bootstrap nodes you can include the following in your machine resource call:

ohai_hints 'ec2' => '{}'

This effectively accomplishes the same thing. Its a neat trick that will save you a bunch of time when you need to manipulate a node based off of specific ec2 metadata.

No comments:

Post a Comment