简体   繁体   中英

run custom cookbook in aws opsworks

I am pretty new to the AWS opsworks. Though I was using chef solo in some other cloud.

Currently I want to install my custom cookbook and I want to apply on my servers which is inside stack layer. Currently I am really confused how it is working in AWS.

Here are the steps i did so far - I have stored my test cookbook in github and I want to execute via chef-solo or chef-client for a test. How ever I have added the cookbook github url in stack settings. I also have added recipe in build life cycle.

I do update cookbook via run command. I can see it is running via runlist after executing all available built-in cookbooks and chef run failing with error-

no cookbook found test-cookbook

I have not configured any Json either in cookbook or while running via command. Is there anything missing?

  • Use berkshelf to create a Berksfile
  • Run berks package cookbooks.tar.gz
  • Upload cookbooks.tar.gz to AWS S3
  • In stack settings point 'Use Custom Cookbooks' to the S3 bucket
  • Run Update Cookbooks command
  • Run deploy or custom recipe you're looking to execute

Thomas V's answer assumes that you want to use an AWS S3 instance. Newer Opsworks installs provide the option to reference a custom Github cookbook repo. Instead of pointing the stack (via stack settings) to an S3 bucket, you can use the Berks package command to grab all dependencies for your custom cookbook, which can then be uploaded to your Github repo and referenced by the stack.

From there, you should be able to use the OpsWorks options to run your custom cookbook after the required cycle (Setup, Configure, Deploy etc) by going to Layers > Recipes and adding it there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM