Chapter 6. Cucumber-Chef: A Worked Example

We’ve come a long way in this book. We’ve explored the thinking behind the Infrastructure as Code paradigm, and outlined some of the risks associated with its implementation. We’ve introduced Chef as a powerful framework for automating infrastructures at scale, and have set ourselves up to use the Opscode platform. We’ve covered the ideas behind test-driven and behavior-driven development, and we’ve described the genesis of a new tool for making possible the automated testing of infrastructures built using Chef. We’ve installed this tool, Cucumber-Chef, and have an idea of its basic architecture. In this chapter, we’re going to make use of the platform that Cucumber-Chef provides, and do some real test-driven infrastructure development.

As we work through this chapter, we’ll introduce some of the concepts and workflows that characterize building infrastructure using Chef, so this chapter really serves not only as an introduction to the idea of test-driven infrastructure, but also as a tutorial for getting started with Chef.

Let’s just review the prerequisites to continue through this chapter of the book. At this stage you should have:

  • Chef installed via RubyGems

  • An Opscode platform account, user key and validation key

  • An AWS account, together with access key ID and secret access key

  • The private half of an EC2 ssh key pair, and its name on the AWS management console

  • A knife.rb populated with placeholders for your AWS credentials

  • Environment variables ...

Get Test-Driven Infrastructure with Chef now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.