Installing Custom Cookbooks
Important
The AWS OpsWorks Stacks service reached end of life on May 26, 2024 and has been disabled for both new and existing customers.
We strongly recommend customers migrate their workloads to other solutions as soon as possible. If you have questions about migration, reach out to the AWS Support Team on AWS re:Post
To have a stack install and use custom cookbooks, you must configure the stack to enable custom cookbooks, if it is not already configured. You must then provide the repository URL and any related information such as a password.
Important
After you have configured the stack to support custom cookbooks, AWS OpsWorks Stacks automatically installs your cookbooks on all new instances at startup. However, you must explicitly direct AWS OpsWorks Stacks to install new or updated cookbooks on any existing instances by running the Update Custom Cookbooks stack command. For more information, see Updating Custom Cookbooks. Before you enable Use custom Chef cookbooks on your stack, be sure that custom and community cookbooks that you run support the version of Chef that your stack uses.
To configure a stack for custom cookbooks
-
On your stack's page, click Stack Settings to display its Settings page., Click Edit to edit the settings.
-
Toggle Use custom Chef cookbooks to Yes.
-
Configure your custom cookbooks.
When you are finished, click Save to save the updated stack.
Specifying a Custom Cookbook Repository
Linux stacks can install custom cookbooks from any of the following repository types:
-
HTTP or Amazon S3 archives.
They can be either public or private, but Amazon S3 is typically the preferred option for a private archive.
-
Git and Subversion repositories provide source control and the ability to have multiple versions.
Windows stacks can install custom cookbooks from Amazon S3 archives and Git repositories.
All repository types have the following required fields.
-
Repository type–The repository type
-
Repository URL–The repository URL
AWS OpsWorks Stacks supports publicly hosted Git repository sites such as GitHub
For a public Git repository, use the HTTPS or Git read-only protocols:
-
Git read-only –
git://github.com/amazonwebservices/opsworks-example-cookbooks.git
. -
HTTPS –
https://github.com/amazonwebservices/opsworks-example-cookbooks.git
.
For a private Git repository, you must use the SSH read/write format, as shown in the following examples:
-
Github repositories –
git@github.com:
.project
/repository
-
Repositories on a Git server –
user
@server
:project
/repository
The remaining settings vary with the repository type and are described in the following sections.
HTTP Archive
Selecting Http Archive for Repository type displays two additional settings, which you must complete if the archive is password protected.
-
User name–Your user name
-
Password–Your password
Amazon S3 Archive
Selecting S3 Archive for Repository type displays the following additional, optional settings. AWS OpsWorks Stacks can access your repository by using Amazon EC2 roles (host operating system manager authentication), whether you use the AWS OpsWorks Stacks API or console.
-
Access key ID –An AWS access key ID, such as AKIAIOSFODNN7EXAMPLE.
-
Secret access key – The corresponding AWS secret access key, such as wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY.
Git Repository
Selecting Git under Source Control displays the following additional optional settings:
- Repository SSH key
-
You must specify a deploy SSH key to access private Git repositories. For Git submodules, the specified key must have access to those submodules. For more information, see Using Git Repository SSH Keys.
Important
The deploy SSH key cannot require a password; AWS OpsWorks Stacks has no way to pass it through.
- Branch/Revision
-
If the repository has multiple branches, AWS OpsWorks Stacks downloads the master branch by default. To specify a particular branch, enter the branch name, SHA1 hash, or tag name. To specify a particular commit, enter the full 40-hexdigit commit ID.
Subversion Repository
Selecting Subversion under Source Control displays the following additional settings:
-
User name–Your user name, for private repositories.
-
Password–Your password, for private repositories.
-
Revision–[Optional] The revision name, if you have multiple revisions.
To specify a branch or tag, you must modify the repository URL, for example:
http://repository_domain/repos/myapp/branches/my-apps-branch
orhttp://repository_domain_name/repos/calc/myapp/my-apps-tag
.