Manually Running Recipes - AWS OpsWorks

Manually Running Recipes


AWS OpsWorks Stacks is no longer accepting new customers. Existing customers will be able to use the OpsWorks console, API, CLI, and CloudFormation resources as normal until May 26, 2024, at which time they will be discontinued. To prepare for this transition, we recommend you transition your stacks to AWS Systems Manager as soon as possible. For more information, see AWS OpsWorks Stacks End of Life FAQs and Migrating your AWS OpsWorks Stacks applications to AWS Systems Manager Application Manager.

Although recipes typically are run automatically in response to lifecycle events, you can manually run recipes at any time on any or all stack instances. This feature is typically used for tasks that don't map well to a lifecycle event, such as backing up instances. To run a custom recipe manually, it must be in one of your custom cookbooks, but it does not have to be assigned to a lifecycle event. When you run a recipe manually, AWS OpsWorks Stacks installs the same deploy attributes that it does for a Deploy event.

To manually run recipes on stack instances
  1. On the Stack page, click Run command. For Command, select Execute Recipes.

                        Execute Recipes command on the Run command page
  2. Enter the recipes to be run in the Recipes to execute box by using the standard cookbookname::recipename format. Use commas to separate multiple recipes; they will run in the order that you list them.

  3. Optionally, use the Custom Chef JSON box to add a custom JSON object that defines custom attributes that will be merged into the stack configuration and deployment attributes that are installed on the instances. For more information about using custom JSON objects, see Using Custom JSON and Overriding Attributes.

  4. Under Instances, select the instances on which AWS OpsWorks Stacks should run the recipes.

When a lifecycle event occurs, the AWS OpsWorks Stacks agent receives a command to run the associated recipes. You can manually run these commands on a particular instance by using the appropriate stack command or by using the agent CLI's run_command command. For more information on how to use the agent CLI, see AWS OpsWorks Stacks Agent CLI.