Install the AWS CLI on a Delegate

Updated 2 weeks ago by Michael Cretzman

If you want to run AWS CLI scripts on the Harness Delegate, you need to install the AWS CLI on its host(s).

For example, you might add a Shell Script step in a Workflow that runs AWS CLI commands to describe instances.

You can add the installation script to a Harness Delegate Profile and then apply that Profile to all the Delegates you want.

You don't need to install the AWS CLI onto a Delegate to perform deployments in AWS. See AWS AMI Quickstart, AWS Lambda Quickstart, AWS CodeDeploy Quickstart, and AWS ECS Quickstart.

In this topic:

Before You Begin

Step 1: Create Delegate Profile

  1. In Harness, click Setup.
  2. Click Harness Delegates.
  3. Click Manage Delegate Profiles, and then click Add Delegate Profile. The Manage Delegate Profile settings appear.

Next, we'll add the script for installing the AWS CLI.

For information on the Delegate Requires Approval setting, see Approve or Reject Harness Delegates.

Step 2: Add AWS CLI Installation Script

In Startup Script, enter the script to install the AWS CLI.

For example, the following Profile script installs the  AWS CLI version 2 on the Delegate host.

curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

Ensure that the script can be run on the Linux operating system of the Delegate host. This example assumes the Delegate host(s) includes zip.

In some cases, the type of Delegate you use impacts the script. For example, a Docker Delegate won't need sudo.

When you are done, click Submit.

Step 3: Apply Delegate Profile to Delegate

In the listing for the Delegate, in Profile, select the Delegate Profile you created.

When you are prompted to confirm, click Confirm.

The message Delegate profile Install AWS CLI saved successfully appears.

Wait a few minutes for the Profile script to run on the Delegate host(s) and for Harness to receive any output.

The Profile status icon indicates whether the script ran successfully.

Step 4: Check Profile Status

In the listing of the Delegate where you applied the profile, in Profile, click View Logs.

If you see the message, Profile execution log temporarily unavailable. Try again in a few moments, the Delegate is still applying the script. Simply wait a few more minutes.

You will see the successful output of the installation.

If the Profile does not work, change the script in the Profile and try again. To try the new Profile script, switch the Profile on the Delete to another Profile, such as Primary, and then back to the revised AWS CLI Profile.

See Also

For a list of other script you can apply using Profiles, see Common Delegate Profile Scripts.


How did we do?