Menu
AWS OpsWorks
User Guide (API Version 2013-02-18)

Add Nodes for the Chef Server to Manage

The chef-client agent runs Chef recipes on physical or virtual computers, called nodes, that are associated with the server. You can connect on-premises computers or instances to the Chef server to manage, provided the nodes are running supported operating systems. Registering nodes with the Chef server installs the chef-client agent software on those nodes.

This walkthrough demonstrates how to run a knife command that adds, or bootstraps, an EC2 instance so that the Chef server can manage it. For more information about how to add nodes automatically by using a script to perform unattended association of nodes with the Chef server, see Adding Nodes Automatically in AWS OpsWorks for Chef Automate.

Supported Operating Systems

For the current list of supported operating systems for nodes, see the Chef website.

Add Nodes with Knife

The knife-ec2 plug-in is included with the Chef DK. If you are more familiar with knife-ec2, you can use it instead of knife bootstrap to provision and bootstrap new EC2instances. Otherwise, launch a new EC2 instance, and then follow the steps in this section.

To add nodes to manage

  1. Run the following knife bootstrap command. This command bootstraps an EC2 instance to the nodes that your Chef server will manage. Note that you are instructing the Chef server to run recipes from the apache2 cookbook that you installed in Use Berkshelf to Get Cookbooks from a Remote Source. For more information about adding nodes by running the knife bootstrap command, see Bootstrap a Node in the Chef documentation.

    The following table shows valid user names for node operating systems in the knife command in this step. If neither root nor ec2-user works, check with your AMI provider. For more information about connecting to Linux-based instances, see Connecting to Your Linux Instance Using SSH in the AWS documentation.

    Valid values for user names in node operating systems

    Operating SystemValid User Names
    Amazon Linuxec2-user
    Red Hat Enterprise Linux 5root or ec2-user
    Ubuntuubuntu
    Fedorafedora or ec2-user
    SUSE Linuxroot or ec2-user

    knife bootstrap INSTANCE_IP_ADDRESS -N INSTANCE_NAME -x USER_NAME --sudo --run-list "recipe[apache2]"
  2. Verify that the new node was added by running the following commands, replacing INSTANCE_NAME with the name of the instance that you just added.

    knife client show INSTANCE_NAME
    knife node show INSTANCE_NAME

More Info

Visit the Learn Chef tutorial site to learn more about using AWS OpsWorks for Chef Automate servers and Chef Automate premium features.