AWS OpsWorks
User Guide (API Version 2013-02-18)

Step 2: Configure your stack and layer to use custom cookbooks

Chef 12 stacks in AWS OpsWorks Stacks require your own or community-created cookbooks to build custom application layers. For this walkthrough, you can point to a repository that contains a set of Chef cookbooks and Chef recipes. These recipes install the Node.js package and its dependencies on your instance. You will use other Chef recipes to deploy the Node.js app that you will prepare in Step 4: Add your app to AWS OpsWorks Stacks. The Chef recipe that you specify in this step runs every time a new version of your application is deployed by CodePipeline.

  1. In the AWS OpsWorks Stacks console, open the stack that you created in Step 1: Create a stack, layer, and an instance in AWS OpsWorks Stacks. Choose Stack Settings, and then choose Edit.

  2. Set Use custom Chef cookbooks to Yes. This shows related custom cookbook settings.

  3. From the Repository type drop-down list, choose S3 Archive. To work with both CodePipeline and AWS OpsWorks, your cookbook source must be S3.

  4. For Repository URL, specify Your settings should resemble the following.

            Use custom Chef cookbooks setttings.
  5. Choose Save.

  6. In the navigation pane, choose Layers.

  7. Choose Settings for the layer you created in Step 1: Create a stack, layer, and an instance in AWS OpsWorks Stacks.

  8. On the General Settings tab, be sure that the layer name is Node.js App Server, and the layer short name is app1. Choose Recipes.

  9. On the Recipes tab, specify nodejs_demo as the recipe you want to run during the Deploy lifecycle event. Choose Save.

    Your recipe settings should resemble the following:

            Layer recipe settings
  10. On the Security tab, from the Security groups drop-down list, choose the AWS-OpsWorks-Webapp security group.

  11. Choose Save.