Creating and using multiple profiles using CDE CLI

You can now add a collection of CDE CLI configurations grouped together as profiles, to the config.yaml file. You can use these profiles while running commands. You can set the configurations either at a profile level or at a global level.

The CDE CLI client uses ~/.cde/config.yaml configuration file to define the default CDE virtual cluster to interact with and to define other configuration parameters. CDE CLI now supports the profiling option in the configuration file. A profile is a collection of configurations that you can apply to a CLI command. Multiple named profiles can be stored in the configuration file.
Make sure that you have downloaded the CLI client. For more information, see Using the Cloudera Data Engineering command line interface.
  1. Create or open the ~/.cde/config.yaml file.
  2. Add profiles to the config.yaml file based on the following structure:
    <Global Configurations>
    
    profiles:
    - name: <Profile Name 1>        
     <Profile Configurations>
    - name: <Profile Name 2>
     <Profile Configurations>

    Example Configuration file:

    vcluster-endpoint: https://g7f9bnv2.cde.dev.cldr.work/dex/api/v1
    user: cdpuser
    
    profiles:
    - name: dev
      user: cdpuser1
      vcluster-endpoint: https://y86gbhv3.cde.dev.cldr.work/dex/api/v1
    
    - name: test
      vcluster-endpoint: https://g7f9bnv2.cde8x.dev.cldr.work/dex/api/v1
    • Global Configuration: These configurations are set at the global level. The configurations set here are used by default when a profile name is not specified or the configuration is not specified in the profile
    • Profile Configuration: These configurations are set at the profile level and overrides the respective configurations set at the global level. You can select the profile either by using the environment variables, or command flags.
  3. You can select the profile using the flag or environment variable.

    Flag

    cde job list --config-profile <PROFILE NAME>

    Environment variable

    export CDE_CONFIG_PROFILE=<PROFILE NAME>
    cde job list
  4. [Optional] You can view the active profile in the configuration file.
    cde profile show-active