Configure Regions in the CLI

The config namespace contains all the commands that you will need to configure the CLI as per your requirements.

Contentstack currently supports the following regions:

Cloud ProviderRegionArguments
AWSNorth AmericaAWS-NA
AWSEuropeAWS-EU
AWSAustraliaAWS-AU
AzureNorth AmericaAzure-NA
AzureEuropeAzure-EU
Google Cloud PlatformNorth AmericaGCP-NA
Google Cloud PlatformEuropeGCP-EU

Using the following set of commands you can configure the regions in the CLI.

Prerequisites

Commands

Get region

The config:get:regioncommand will return the name of the region on which you are performing actions in Contentstack, via the CLI.

Usage

csdx config:get:region

Set region

The config:set:region command lets you select a region, from the available Contentstack regions, to perform actions using the CLI.

Usage

csdx config:set:region <<region>>

Arguments

  • Region: Specifies the region that you want to use while executing the CLI commands. Possible values are as follows:
    • AWS-NA for AWS North America
    • AWS-EU for AWS Europe
    • AWS-AU for AWS Australia
    • AZURE-NA for Azure North America
    • AZURE-EU for Azure Europe
    • GCP-NA for Google North America
    • GCP-EU for Google Europe

Example

csdx config:set:region AWS-NA
csdx config:set:region AWS-EU
csdx config:set:region AWS-AU
csdx config:set:region AZURE-NA
csdx config:set:region AZURE-EU
csdx config:set:region GCP-NA
csdx config:set:region GCP-EU

Set custom host and region

By using the config:set:region command, you can also set a custom host for Content Delivery, Content Management, UI Host, Developer Hub, Launch, and Personalize APIs, and set a custom region name for the hosts.

Usage

csdx config:set:region --cda <<custom_cda_host_url>> --cma <<custom_cma_host_url>> --ui-host <<custom_ui_host_url>> -n <<custom_region_name>>
--developer-hub <<custom_developer_hub_url>> --launch <<custom_launch_url>> --personalize <<custom_personalize_url>>

Options

  • --cda=cda: Custom host to set for the Content Delivery API. If this flag is used, then cma, ui-host, and name flags are required.
  • --cma=cma: Custom host to set for the Content Management API. If this flag is used, then cda,
    ui-host, and name flags are required.
  • --ui-host=ui-host: Custom UI host to set for CLI. If this flag is used, then cda, cma, and name flags are required.
  • -n, --name=name: The name for the region. If this flag is used, then cda, cma, and ui-host flags are required.
  • --developer-hub: Custom host to set for the Developer Hub API.
  • --launch: Custom host to set for the Launch API.
  • --personalize: Custom host to set for the Personalize Management API.

NoteThe CLI generates the Developer Hub, Launch, and Personalize APIs by default unless their corresponding flags are passed.

Example

csdx config:set:region --cda "https://in-cdn.contentstack.com" --cma "https://in-api.contentstack.com" --ui-host "https://in-app.contentstack.com" --developer-hub "https://in-developerhub-api.contentstack.com" --launch "https://in-launch-api.contentstack.com" --personalize "https://in-personalize-api.contentstack.com" -n "India"