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.1.1

Chef integration with AWS cloudformation

cookbook 'chef_cfn', '~> 2.1.1'
cookbook 'chef_cfn', '~> 2.1.1', :supermarket
knife supermarket install chef_cfn
knife supermarket download chef_cfn
Quality 38%

chef_cfn Cookbook

This cookbook provides tools which aid in the integration of Chef and AWS, specifically with CloudFormation.


  • This cookbook will shortly be undergoing a refactor and cleanup



  • chef_handler
  • python
  • ohai


Feature Flags

The recipes included within default.rb my be selectively enabled by toggling the appropriate feature flags.

<table> <tr> <td>Attribute</td> <td>Description</td> <td>Default</td> </tr> <tr> <td><code>node['cfn']['recipes']['awslogs']</code></td> <td>Install the cloudwatch logs daemon named awslogs</td> <td><code>false</code></td> </tr> <tr> <td><code>node['cfn']['recipes']['cloudinit']</code></td> <td>Configure a stripped down cloud-init to speed up cloud instance startup time</td> <td><code>false</code></td> </tr> <tr> <td><code>node['cfn']['recipes']['coudwatch']</code></td> <td>Install a cloudwatch event handler to report chef runs back to cloudwatch events.</td> <td><code>true</code></td> </tr> <tr> <td><code>node['cfn']['recipes']['handler']</code></td> <td>Deprecated Install a cfn-init chef handler which will report chef-run success to cloudformatin. <td><code>true</code></td> </tr> <tr> <td><code>node['cfn']['recipes']['mounts']</code></td> <td>Format and mount volumes based on metadata provided in cloudformation</td> <td><code>true</code></td> </tr> <tr> <td><code>node['cfn']['recipes']['ohai']</code></td> <td>Install an ohai plugin to fetch instance, stack and metadata from ec2. </td> <td><code>true</code></td> </tr> <tr> <td><code>node['cfn']['recipes']['shutdown']</code></td> <td>Deprecated Install a service which will delete the chef client and node on shutdown</td> <td><code>true</code></td> </tr> <tr> <td><code>node['cfn']['recipes']['tools']</code></td> <td>Install the cfn-init and cfn-signal tools</td> <td><code>true</code></td> </tr> </table>

Ohai Attributes

<table> <tr> <td>Attribute</td> <td>Description</td> <td>Default</td> </tr> <tr> <td><code>node['cfn']['vpc']</code></td> <td>Informaiton related to the VPC</td> <td><code>{}</code></td> </tr> <tr> <td><code>node['cfn']['tags']</code></td> <td>Hash of the EC2 instance tags</td> <td><code>{}</code></td> </tr> <tr> <td><code>node['cfn']['stack']</code></td> <td>Hash of Cloudformation stack parameters</td> <td><code>{}</code></td> </tr> <tr> <td><code>node['cfn']['properties']</code></td> <td>Hash of arbitrary metadata provided in cloudformation</td> <td><code>{}</code></td> </tr> </table>



Installs dependencies and includes additional recipes based on feature flags.


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


  • Add missing cloudwatch configuration attributes


  • Add cloudwatch events report handler


  • Add missing ohai feature flag
  • Remove additional cfn init modules


  • cloud-init bugfixes
  • awslogs service bugfix


  • 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.1.1 failed this metric

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

Contributing File Metric

2.1.1 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of, and your repo must contain a file

Foodcritic Metric

2.1.1 failed this metric

FC066: Ensure chef_version is set in metadata: chef_cfn/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: chef_cfn/metadata.rb:1
FC069: Ensure standardized license defined in metadata: chef_cfn/metadata.rb:1
FC072: Metadata should not contain "attribute" keyword: chef_cfn/metadata.rb:1
FC121: Cookbook depends on cookbook made obsolete by Chef 14: chef_cfn/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

No Binaries Metric

2.1.1 passed this metric

Publish Metric

2.1.1 passed this metric

Supported Platforms Metric

2.1.1 failed this metric

chef_cfn should declare what platform(s) it supports.

Testing File Metric

2.1.1 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of, and your repo must contain a file

Version Tag Metric

2.1.1 passed this metric