0

I've started to dive into AWS DevOps and I'm trying to use the AWS Chef 12 Stack. I'm brand new to Chef but I have downloaded the ChefDK on my Mac (10.11.4) and successfully created my first Cookbook directory running the chef generate cookbook cookbook-name-here command. My goals are to:

Goals:

  1. Create a Linux based LAMP stack Cookbook to configure my AWS EC2 instance
  2. Package the Cookbook
  3. Add it to my GitHub account (I have this covered)
  4. Link my AWS OpsWorks Chef 12 stack to the GitHub account containing the Cookbook (I have this covered)
  5. Deploy a new EC2 instance that gets configured correctly based on the Cookbook
  6. Use Cookbook/Recipe to Update/Add a simple HTML file to the EC2 instance

All that said, this leads me to ask the following Chef newbie questions.

Additional Chef Questions:

  1. Now that my demo Cookbook has been created, how do I create my own custom Recipes?

    • Do I manually create the recipe ruby files or use terminal command line (CLI)?
    • Once the files are created do I need to run any other Chef CLI command to compile, format, or correctly place the chef recipe ruby file in the Cookbook?
  2. How do I correctly add chef dependencies to my cookbook from the Chef Supermarket? create my own custom recipes.

  3. How do I package all of that up to upload to GitHub or S3.

Any directions, tips, resource links, etc... would be much appreciated. I have also listed my system's chef -v output below:

chef -v Chef Development Kit Version: 0.12.0 chef-client version: 12.8.1 berks version: 4.3.0 kitchen version: 1.6.0

Corey
  • 481
  • 2
  • 5
  • 11
  • StackOverflow is generally suited to asking specific single questions that aren't covered in existing tutorials or documentation. Questions that boil down to "how do I do the thing?" generally go unanswered or closed. – coderanger Apr 15 '16 at 02:35
  • @coderanger thank you for the response and feedback. Based on what I've written/asked, do you have a suggestion for how I could reformat my question(s) to get an answer? I've looked at tutorials and searched the Chef and AWS websites and can't seem to find anything that specifically helps me answer my questions, which is why I've come to ask them here. – Corey Apr 15 '16 at 02:38

1 Answers1

1

I suggest you start by using Berkshelf to manage multiple cookbooks like those from the Supermarket.

A guide from AWS on Berkshelf is available at http://docs.aws.amazon.com/opsworks/latest/userguide/cookbooks-101-opsworks-berkshelf.html

It says it's Chef 11 only but Berkshelf works with Chef 12, just use berks package and upload your cookbook to S3 with aws s3 cp cookbooks.tar.gz s3://your_bucket/cookbooks.tar.gz.

As for creating your own cookbook with recipes, you can do it manually or use the chef generate cookbook your_cookbook_name. If you don't have chef installed, you can install chef using homebrew and homebrew-cask via the command brew cask install chefdk.

More from AWS about creating and using cookbooks can be found at http://docs.aws.amazon.com/opsworks/latest/userguide/gettingstarted-cookbooks.html

databyte
  • 1,228
  • 10
  • 7