OpsWorks Stack Design for Running Custom Recipes on Instance Launch | Exam Prep

Configuring OpsWorks Stack to Run Custom Recipes on Instance Launch

Prev Question Next Question

Question

You are a Devops Engineer and are designing an Opswork stack in AWS.

The company has some custom recipes that are part of their on-premise Chef configuration.

These same recipes need to be run whenever an instance is launched in Opsworks.

Which of the following steps need to be carried out to to ensure this requirement gets fulfilled.

Choose 2 answers from the options given below.

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - A and C.

The AWS Documentation mentions the below.

Each layer has a set of built-in recipes assigned to each lifecycle event, although some layers lack Undeploy recipes.

When a lifecycle event occurs on an instance, AWS OpsWorks Stacks runs the appropriate set of recipes for the associated layer.

The below diagram shows a snapshot in the stack settings where you can enable custom cookbooks.

For more information on automating recipe's , please visit the below URL:

http://docs.aws.amazon.com/opsworks/latest/userguide/workingcookbook-assigningcustom.html
Stack name
Region

vec

Default subnet

Default operating system
Default SSH key

Chef version

Use custom Chef cookbooks

Repository type
Repository URL

Repository SSH key

Branch/Revision

Manage Berkshelf

Demostack

Asia Pacific (Singapore)

vpe-bb4d1bdf

172.31.0.0/20 - ap-southeast-1a - Def ¥

Ubuntu 14.04 LTS

Do not use a default SSH key

11.10

Git

https://github.com/user/cookbooks.git

Optional

Optional

No

Need a different OS? Let us know.

As a DevOps Engineer, you need to ensure that the custom recipes are executed whenever an instance is launched in the Opsworks stack. To achieve this, you should follow the below steps:

  1. Ensure the custom cookbooks option is set in Opswork stack: Custom cookbooks provide the ability to add extra functionality to OpsWorks, beyond the built-in cookbooks. You need to make sure that the custom cookbooks option is set in the Opsworks stack so that it can access the custom recipes from your on-premise Chef configuration. This can be done by adding the required cookbooks in a separate directory and uploading them to the AWS OpsWorks server.

  2. Ensure the recipe is placed as part of the Setup Lifecycle event as part of the Layer setting: Lifecycle events in Opsworks provide hooks into the various stages of an instance's lifecycle. By setting up the custom recipe in the Setup Lifecycle event, it will be executed when the instance is launched. You can do this by specifying the custom recipe in the Setup Lifecycle event as part of the Layer setting. This ensures that the custom recipe is executed every time a new instance is launched.

Therefore, the correct answers are A and C. You need to ensure that the custom cookbooks option is set in the Opsworks stack and the recipe is placed as part of the Setup Lifecycle event as part of the Layer setting.