AWS OpsWorks

AWS OpsWorks is a wonderful tool that I'm growing more and more fond of every day.  However, not being familiar with Chef I've been hamstrung by what I can do with it.  I wanted to be able to create a clean, simple layer but still retain the ability to deploy code automatically to it.  The "other" layer type was perfect, except it didn't include any deployment tools (or other goodies).  So, banging my head against the wall for a couple of days I have some tips to share.

Tip #1 - Chef-Solo is globally scoped

OpsWorks uses Chef-Solo which is globally scoped.  This means that there is no Chef server and you don't have to do any funky namespace things in your custom Chef recipes.  I was trying to copy the OpsWorks Chef recipes into my custom cookbooks, and trying to use Git submodules, and all kinds of funky stuff.  The simple answer is that you don't have to do any of that; just use it like its in your custom cookbook and it will work.

Tip #2 - Drop the manafests

Just a small tip here, Chef-Solo doesn't use the metadata.rb file so there is no need to include it in your cookbook. Unless you really want to, that is.

Tip #3 - Just do it!

You don't have to create your own custom cookbook if you don't want to.  If you find something in the opsworks-cookbooks that you want to use, say opsworks_bundler, then just include it in the Custom Chef Recipes section of the layer edit page:

OpsWorks option screenshot


As with most of my blog posts, this one is written with future me in mind.  If I don't write it down, I'll forget it.  However, it will hopefully help someone else that is in my position of only knowing enough Chef to be dangerous.  I really shouldn't have had to bang my head against this for so long.  :/