Install and configure the New Relic One CLI

One of the primary elements of the New Relic One SDK is the command line interface (CLI). To create a Nerdpack , you'll need to install the SDK, configure the CLI to work with your New Relic account, and then utilize its create command.

Install and configure the CLI

Step 1 of 5

Go to the Build on New Relic quick start.

Step 2 of 5

Get your API key:

API key

Once you install the CLI, you'll use this key to create a user profile that's associated with your account. The CLI uses this profile to manage entities within your account.

Step 3 of 5

Read and accept the New Relic developer terms and conditions:

Terms and conditions

Even if you install the CLI, you won't be able to use it without first accepting these terms and conditions.

Step 4 of 5

Choose your operating system and click Download installer:

Download installer

Once you've installed the SDK, you'll have access to the nr1 CLI. Verify this by checking your SDK version:

bash
$
nr1 --version

If you already had the CLI, update it:

bash
$
nr1 update

Tip

It’s important to distinguish between the newrelic CLI and the nr1 CLI. newrelic is for managing entities in your New Relic account. nr1 is for managing New Relic applications.

Step 5 of 5

Copy the command to save your credentials:

Save your credentials

This command has a profile name, your region, and your API key baked in.

Run the command in your terminal:

bash
$
nr1 profiles:add --name <profile name> --api-key <User key> --region <region>

Profiles let you select which New Relic account you want to run commands against. If you have multiple accounts, you can view them with profiles:list:

bash
$
nr1 profiles:list

Notice that one profile is your default profile. This is the account your commands will run against, unless you specify another. To specify a profile for a particular command, use the --profile option:

bash
$
nr1 create --profile <your profile>

If this is your first time using the CLI, then the profile you just added is your default profile. If you have other profiles, you need to set your default to the one you'd like to use for this course:

bash
$
nr1 profiles:default

Tip

If you forget these commands, you can look them up in the profiles help menu:

bash
$
nr1 profiles --help

Now, you can exit the Build on New Relic quick start. You’re ready to build an application with the New Relic One CLI!