Sugerencia
This lesson is part of a course that teaches you how to build a New Relic application from the ground up. If you haven't already, check out the Overview.
Each lesson in the course builds upon the last, so make sure you've completed the last lesson, Spin up your demo services, before starting this one.
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
Go to the Build on New Relic quick start.
Get your license 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.
As you install the CLI, read and accept the New Relic developer terms and conditions.
Even if you install the CLI, you won't be able to use it without first accepting these terms and conditions.
Choose your operating system and click Download installer.
Once you've installed the SDK, you'll have access to the nr1
CLI. Verify this by checking your SDK version:
$nr1 --version
If you already had the CLI, update it:
$nr1 update
Sugerencia
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.
Copy the command to save your credentials.
This command has a profile name, your region, and your API key baked in.
Run the command in your terminal:
$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
:
$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:
$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:
$nr1 profiles:default
Sugerencia
If you forget these commands, you can look them up in the profiles help menu:
$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!
Sugerencia
This lesson is part of a course that teaches you how to build a New Relic application from the ground up. Continue on to the next lesson: Create a Nerdpack.