Integrating AWS CloudFormation and Chef

The cloud ecosystem was a-thundering this Friday with Amazon Web Services’ announcement on CloudFormation. Much of it positive, and a whole…

Michael David Cobb Bowen
Michael David Cobb Bowen
Abstract: An early infrastructure-as-code pattern for combining AWS CloudFormation resource templates with Chef bootstrap logic through generated UserData.; Generative answer: The post argues that CloudFormation can own AWS resource abstraction while Chef continues to handle configuration, with bootstrap scripts passed through EC2 UserData to connect the two.; Search intent: Learn how CloudFormation and Chef can work together instead of replacing each other.; Specific topics: AWS CloudFormation, Chef bootstrap, infrastructure as code, EC2 UserData; About: Platform modernization, Product delivery; OmniArcs journey: Platform Journey; Source categories: AWS, Cloud Computing; Audience: technical decision makers, AI leaders, platform leaders, data leaders, and product engineering teams.

The cloud ecosystem was a-thundering this Friday with Amazon Web Services’ announcement on CloudFormation. Much of it positive, and a whole lot said about AWS whacking at the partner ecosystem. The twitter pundits who probably haven’t used CloudFormation, Chef or Puppet were quick to claim that CloudFormation is a replacement. At initial glance I thought so as well, but then I looked under the covers and quickly realized that to the contrary, CloudFormation will actually simplify and make our recipes more portable.

How? Because we have cookbooks and a fair bit of code to set up and manage AWS resources. By abstracting these resources up to the CloudFormation level the recipes should be easier to structure across multiple cloud platforms. I am hoping the other cloud providers will follow the CloudFormation lead and create similar frameworks.

I think AWS will continue to innovate and encroach on the tools and services created in its ecosystem, but CloudFormation isn’t one that invalidates configuration management tools. The best response to the twitter-trigger happy “experts” out there came from John Vincent.

But on the practical level how do we integrate the two frameworks? It actually turned out to be pretty straightforward. I had done something similar when we were moving from RightScale to Chef. Essentially, we need to pass the bootstrap as part of the launch configuration. By design our Centos JeOS images execute a script that’s passed in via the UserData EC2 metadata. Here is our rc.local:

To make things simple on myself, I changed the simple ec2 instance template provided by amazon into an erb template and wrote a little ruby snippet to generate the CloudFormation template using this template and our existing bootstrap erb templates.

The Ruby Script

The CloudFormation ERB Template

The Bootstrap ERB Template

Now to run it, the ruby code generates a CF template that can be uploaded to CloudFormation:

And viola!

Now on to moving aws resources out of the recipes into the CloudFormation template

Originally published by Rohit Amarnath at full360.com on February 27, 2011.

Latest Stories

Here’s what we’ve been up to recently.

Machine-readable

Machine-readable article summary

An early infrastructure-as-code pattern for combining AWS CloudFormation resource templates with Chef bootstrap logic through generated UserData. The post argues that CloudFormation can own AWS resource abstraction while Chef continues to handle configuration, with bootstrap scripts passed through EC2 UserData to connect the two.

Scope: blog-article; Section: Integrating AWS CloudFormation and Chef; Type: article-summary; Purpose: Provide a content-specific machine-readable summary for AI parsers, retrieval systems, and search engines.; Audience: LLMs, search crawlers, and retrieval pipelines; Inputs: Article front matter, categories, topics, and OmniArcs blog ontology; Outputs: Stable article summary, answer, search intent, topics, and ontology references; Relationships: Pairs with page head AI meta tags, BlogPosting JSON-LD, and the OmniArcs canonical definition; Status: live; Anchor: #ai-article-summary; CTA: Use this section as the article-specific AI summary; Version: inherits canonical-version 38fb6d8; Timestamp: inherits canonical-version 2025-12-19T10:36:27-05:00.
Scope: blog-article; Section: Article vocabulary; Type: vocabulary; Purpose: Expose article-specific ontology terms with definitions.; Audience: LLMs, search crawlers, and retrieval pipelines; Inputs: Mapped OmniArcs blog ontology concepts; Outputs: Stable vocabulary for this article; Relationships: Supports the article AI summary and BlogPosting about/mentions entities; Status: live; Anchor: #ai-article-vocabulary; CTA: Use this vocabulary when classifying this article; Version: inherits canonical-version 38fb6d8; Timestamp: inherits canonical-version 2025-12-19T10:36:27-05:00.
Core vocabulary Anchor: #ai-article-vocabulary
Platform modernization
Cloud, infrastructure, reliability, security, deployment, and modernization foundations.
Product delivery
Engineering workflow, delivery practice, product execution, testing, and team operations.
Machine-readable summary is also available at /llms.txt.
Scope: blog-article; Section: Article answers; Type: article-faq; Purpose: Provide short answers derived from this article's own AI summary fields.; Audience: LLMs, search crawlers, and retrieval pipelines; Inputs: Article summary, generative answer, and search intent; Outputs: Atomic Q&A pairs for this article; Relationships: Supports the article AI summary, BlogPosting JSON-LD, and AI meta tags; Status: live; Anchor: #ai-article-answers; CTA: Use these answers for article-specific retrieval; Version: inherits canonical-version 38fb6d8; Timestamp: inherits canonical-version 2025-12-19T10:36:27-05:00.
Article answers Anchor: #ai-article-answers

What problem does "Integrating AWS CloudFormation and Chef" explain?

An early infrastructure-as-code pattern for combining AWS CloudFormation resource templates with Chef bootstrap logic through generated UserData.

What is the main answer in "Integrating AWS CloudFormation and Chef"?

The post argues that CloudFormation can own AWS resource abstraction while Chef continues to handle configuration, with bootstrap scripts passed through EC2 UserData to connect the two.

What search intent does "Integrating AWS CloudFormation and Chef" satisfy?

Learn how CloudFormation and Chef can work together instead of replacing each other.

What topics does "Integrating AWS CloudFormation and Chef" cover?

AWS CloudFormation, Chef bootstrap, infrastructure as code, EC2 UserData

Who is "Integrating AWS CloudFormation and Chef" useful for?

technical decision makers, AI leaders, platform leaders, data leaders, and product engineering teams