Configuringedit
In order for ecctl to be able to communicate with the RESTful API, it needs to have a set of configuration parameters defined. These parameters can be set in a configuration file, through environment variables, or at runtime using the CLI’s global flags.
Before you beginedit
The hierarchy for configuration parameters is as follows, from higher precedence to lower:
-
Command line flags
--host
,--user
,--pass
- Environment variables
-
Shared configuration file
$HOME/.ecctl/config.<json|toml|yaml|hcl>
Generate a configuration fileedit
If it’s your first time using ecctl, use the init
command to assist you in generating a configuration file. The resulting configuration file will be saved under ~/.ecctl/config.json
:
$ ecctl init Welcome to the Elastic Cloud CLI! This command will guide you through authenticating and setting some default values. Missing configuration file, would you like to initialise it? [y/n]: y Select which type of Elastic Cloud offering will you be working with: [1] Elasticsearch Service (default). [2] Elastic Cloud Enterprise (ECE). [3] Elasticsearch Service Private (ESSP). Please enter your choice: 1 Using "https://api.elastic-cloud.com" as the API endpoint. Paste your API Key and press enter: xxxxx What default output format would you like? [1] text - Human-readable output format, commands with no output templates defined will fall back to JSON. [2] json - JSON formatted output API responses. Please enter a choice: 1 Your credentials seem to be valid, and show you're authenticated as "user". You're all set! Here is a command to try: $ ecctl deployment list