Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms


chef_cfn (9) Versions 2.0.1

Chef integration with AWS cloudformation

cookbook 'chef_cfn', '= 2.0.1'
cookbook 'chef_cfn', '= 2.0.1', :supermarket
knife supermarket install chef_cfn
knife supermarket download chef_cfn
Quality 0%

Chef_cfn Cookbook

Provide tools to aid in the integration of Chef with AWS Cloudformation.



  • chef_handler
  • python
  • ohai


<table> <tr> <td>Attribute</td> <td>Description</td> <td>Default</td> </tr> <tr> <td><code>node['cfn']['properties']</code></td> <td>Cloudformation metadata properties merged with cfn hint</td> <td><code>{}</code></td> </tr> <tr> <td><code>node['cfn']['properties']['mounts']</code></td> <td>Provides a mechanism to ensure volumes are mounted during chef</td> <td><code>{}</code></td> </tr> <tr> <td><code>node['cfn']['recipes']</code></td> <td>Booleans determining which recipes are executed</td> <td><code>{}</code></td> </tr> <tr> <td><code>node['cfn']['stack']</code></td> <td>Cloudformation Stack ohai namespace</td> <td><code>{}</code></td> </tr> <tr> <td><code>node['cfn']['stack']['autoscaling_name']</code></td> <td>Name of the autoscaling group that spawn the instance</td> <td><code>ohai</code></td> </tr> <tr> <td><code>node['cfn']['stack']['logical_id']</code></td> <td>Cloudformation stack logical id</td> <td><code>ohai</code></td> </tr> <tr> <td><code>node['cfn']['stack']['stack_id']</code></td> <td>Cloudformation stack id</td> <td><code>ohai</code></td> </tr> <tr> <td><code>node['cfn']['stack']['stack_name']</code></td> <td>Cloudformation stack name</td> <td><code>ohai</code></td> </tr> <tr> <td><code>node['cfn']['tags']</code></td> <td>Cloudformation Tags ohai namespace, converted to snake case</td> <td><code>{}</code></td> </tr> <tr> <td><code>node['cfn']['tools']['delete_on_shutdown']</code></td> <td>Delete the chef node on instance shutdown</td> <td><code>true</code></td> </tr> <tr> <td><code>node['cfn']['tools']['cfn_hup']['interval']</code></td> <td>cfn-hup will scan for metadata changes every N seconds</td> <td><code>10</code></td> </tr> <tr> <td><code>node['cfn']['tools']['cfn_hup']['verbose']</code></td> <td>Should cfn-hup provide verbose output</td> <td><code>false</code></td> </tr> <tr> <td><code>node['cfn']['tools']['url']</code></td> <td>Tarball url for cfn-init installation</td> <td><code></code></td> </tr> <tr> <td><code>node['cfn']['vpc']</code></td> <td>Cloudformation VPC ohai namespace</td> <td><code>{}</code></td> </tr> <tr> <td><code>node['cfn']['vpc']['region_id']</code></td> <td>Aws region the instance belongs to</td> <td><code>ohai</code></td> </tr> <tr> <td><code>node['cfn']['vpc']['subnet_id']</code></td> <td>Aws subnet the instance belongs to</td> <td><code>ohai</code></td> </tr> <tr> <td><code>node['cfn']['vpc']['vpc_id']</code></td> <td>Aws vpc the instance belongs to</td> <td><code>ohai</code></td> </tr> </table>



Installs dependencies


Install and configure the cloudwatch logs service


Configure cloud-init in a more stripped down ec2-specific way. This recipe is mostly of use when packaging AMIs with Packer.


Install the CFN handler to callback to cloudformation on stack updates. Although this is still here, you'd likely be better off simply calling cfn-signal directly from user-data.


(optional) Provides a basic knife.rb


Installs the aws-sdk chef_gem as well as the ohai[cfn] plugin. When this runs, it will populate the properties, stack, tags and vpc attribute hashes under the node['cfn'] namespace which may then be used to report signals with the signal handler.

In addition, the properties hash will be merged, and potentially overriden, by any hints set in the cfn hint.

Required IAM policies
    "Version": "2012-10-17",
    "Statement": [
            "Sid": "Stmt1434370036000",
            "Effect": "Allow",
            "Action": [
            "Resource": [


Installs a handler to signal cloudformation of the success or failure of the chef run. When used with either Creation or Update profiles in cloudformation, we can ensure that only nodes with valid chef runs are considered healthy.

This may be disabled by setting

Required IAM policies
    "Version": "2012-10-17",
    "Statement": [
            "Sid": "Stmt1434370036000",
            "Effect": "Allow",
            "Action": [
            "Resource": [
Example Cloudformation
  "AutoScailingGroup": {
    "CreationPolicy": {
      "ResourceSignal": {
        "Count": 1,
        "Timeout": "PT10M"
    "UpdatePolicy": {
      "AutoScalingRollingUpdate": {
        "WaitOnResourceSignals": "true"


Mounts cloudformation defined volumes.

Please take note that this recipe assumes that cloudformation was responsible to creating and managing the volumes, not chef. As such, all block devices must exist prior to attempting to mount them.

Example Cloudformation Attributes
  "AutoScailingGroup": {
    "Metadata": {
      "Mounts": {
        "xvdb3": {
          "mount_point": "/var/log",
          "mount_options": "",
          "filesystem": ""


Installs cloudformation cfn-init tools such as :

  • cfn-init
  • cfn-hup: Periodic polling of cloudformation resource metadata to determine when triggered actions should run.


Installs a service which will delete the node when the instance shuts down.



Provides an interface to trigger cloudformation signals from within recipes. This is designed to be used with cloudformation WaitConditions.


  • signal: Default action

Attribute Parameters

  • url: Url of the resource or WaitHandler to signal
  • unique_id: Unique id of the notification
  • data: Defaults to <code>""</code>.
  • success: Defaults to <code>true</code>.
  • reason: Defaults to <code>"Chef triggered signal from resource"</code>.
  • once: Defaults to <code>true</code>.

Ohai Plugins


Fetches instance attributes from Cloudformation:DescribeResource as well as EC2:DescribeInstances.

License and Author

Author:: Jonathan Serafini (

Copyright:: 2015, Jonathan Serafini

License:: Apache 2.0

Dependent cookbooks

python >= 1.4.0
ohai >= 4.0.0
chef_handler >= 0.0.0

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

chef_cfn changelog


  • Bugfixes


  • Refactor code for cookstyle
  • Add recipe feature flags to disable some recipes
  • Add boolean to disable cloudformation handler
  • Add awslogs installation


  • Update ohai recipes to rely on the newer ohai v4+ format


  • Rubocop auto-correct Style/StringLiterals
  • Rubocop auto-correct Style/TrailingBlankLines
  • Rubocop auto-correct Style/TrailingWhitespace
  • Rubocop auto-correct Lint/DeprecatedClassMethods
  • Rubocop auto-correct Style/SpaceAroundEqualsInParameterDefault
  • Rubocop auto-correct Style/ExtraSpacing
  • Rubocop auto-correct Style/SpaceAfterComma
  • Rubocop auto-correct Style/SpaceAroundOperators
  • Rubocop auto-correct Style/AndOr


  • Ongoing work


  • Initial release of chef_cfn

Collaborator Number Metric

2.0.1 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Foodcritic Metric

2.0.1 failed this metric

FC038: Invalid resource action: /tmp/a5e7e0cd87a41d03da8165a0/chef_cfn/recipes/mounts.rb:26
Run with Foodcritic Version 8.0.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any