Install the AWS CLI on a Delegate
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
- Step 2: Add AWS CLI Installation Script
- Step 3: Apply Delegate Profile to Delegate
- Step 4: Check Profile Status
- See Also
Before You Begin
- Harness Delegate Overview
- Common Delegate Profile Scripts
- Installing the AWS CLI version 2 on Linux from AWS
- Using the Shell Script Step
Step 1: Create Delegate Profile
- In Harness, click Setup.
- Click Harness Delegates.
- 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://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
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.