Installing a Package on a Windows Instance

Note

This example assumes that you have already done the Running a Recipe on a Windows
Instance example. If not,
you should do that example first. In particular, it describes how to enable RDP
access to your instances.

If your software comes in an installer package, such as an MSI, you must download
the file to the instance and then run it. This example shows how to implement a
cookbook to install an MSI package, the Python runtime, including how to define
associated environment variables. For more information on how to install Windows
features such as IIS, see Installing a Windows
Feature: IIS.

To set up the cookbook

Create a directory named installpython and navigate
to it.

Add a metadata.rb file to
installpython with the following content.

name "installpython"
version "0.1.0"

Add recipes and files
directories to installpython and add a
default directory to files.

Download a Python package from Python Releases for
Windows to the cookbook's files\default
directory. This example installs the Windows x86-64 version of Python
3.5.0a3, which uses an MSI installer named
python-3.4.3.amd64.msi.

Add a file named default.rb to the
recipes directory with the following recipe
code.

Execute the recipe by running the Execute Recipes
stack command with Recipes to execute set to
installpython::default. This command initiates a
Chef run, with a run list that consists of
installpython::default.

Note

This example uses Execute Recipes for
convenience, but you typically have AWS OpsWorks Stacks run your recipes
automatically by assigning them to the appropriate lifecycle
event. You can run such recipes by manually triggering the event. You
can use a stack command to trigger Setup and Configure events, and a
deploy command to
trigger Deploy and Undeploy events.