Step 1: Define environment variables

You're viewing Apigee X documentation.
View Apigee Edge documentation.

What you're doing in this step

This section describes how to set several environment variables that are used throughout the documentation (and especially in this configuration tutorial). Google strongly recommends that you use them so that you can enter the commands as shown.

This is the first of two steps you will perform at the command line before starting the Apigee provisioning wizard.

Perform the step

To define environment variables on the command line:

  1. Define the following environment variables for the current project:
    PROJECT_ID="YOUR_PROJECT_ID"
    PROJECT_NUMBER=$(gcloud projects describe $PROJECT_ID --format="value(projectNumber)")
    RUNTIME_LOCATION="YOUR_RUNTIME_LOCATION"
    ANALYTICS_REGION="YOUR_ANALYTICS_REGION"
    APPKEY_LOCATION="APPKEY_LOCATION"
    APPKEY_KEY_RING_NAME="APPKEY_KEY_RING_NAME"
    APPKEY_KEY_NAME="APPKEY_KEY_NAME"
    DISK_KEY_RING_NAME="DISK_KEY_RING_NAME"
    DISK_KEY_NAME="DISK_KEY_NAME"
    

    Where:

    • PROJECT_ID is the Cloud project ID that you created as part of the Prerequisites. If you're not sure what your project ID is, use Cloud Console or the gcloud projects list command to find it.
    • PROJECT_NUMBER is the Cloud project number that you created as part of the Prerequisites. This example issues a gcloud command to get the project number for you. Alternatively, you can find it in the Google Cloud Console project dashboard or you can use the gcloud projects list command to find it.
    • RUNTIME_LOCATION is the physical location where your instance is located. Valid values are any Compute Engine region (for paid orgs) or Compute Engine zone (for eval orgs). For more information, see Compute Engine locations.

    • ANALYTICS_REGION is the physical location at which you store your analytics data.

      Valid values are a subset of the Compute Engine regions. Possible values are:

      • asia-northeast1
      • asia-south1
      • europe-west1
      • us-central1
      • us-east1
      • us-west1
      • australia-southeast1
      • europe-west2

      Both eval and paid accounts use regions for the analytics location. Therefor, for paid orgs its value can be the same as the RUNTIME_LOCATION (also a region). But the value of ANALYTICS_REGION does not have to be the same as RUNTIME_LOCATION. However, there may be a performance benefit if they are the same.

      For eval accounts, the analytics location is a region but the runtime location is a zone, so they will not be the same.

    • RUNTIME_LOCATION is the physical location where your application key ring and key are stored. Apigee uses an application key to encrypt application data such as KVMs, cache, and client secrets, which is then stored in the database.

      Similar to the analytics region, valid values are a subset of the Compute Engine regions. The value can be the same as your $RUNTIME_LOCATION (also a region) but does not have to be. There may be a performance benefit if they are the same.

    • RUNTIME_LOCATION is the name ofthe key ring the application key is stored in. The key ring's name must be unique to your organization. If you create additional regions, the key ring names for those regions cannot be the same as existing key ring names.
    • APPKEY_KEY_NAME is the name of the application key. Application key names must be unique within a given key ring.
    • DISK_KEY_RING_NAME is the name of the disk key ring. It The disk key ring name must be different from the application key name. You will create the disk key ring in the same location as your $RUNTIME_LOCATION.
    • DISK_KEY_NAME is the name of the disk encryption key, which Apigee uses to encrypt runtime instance data before it is written to disk.

    The following example defines environment variables for a paid org.

    PROJECT_ID="my-cloud-project"
    PROJECT_NUMBER=$(gcloud projects describe $PROJECT_ID --format="value(projectNumber)")
    RUNTIME_LOCATION="us-west1"
    ANALYTICS_REGION="us-west1"
    APPKEY_LOCATION="us-west1"
    APPKEY_KEY_RING_NAME="us-west1"
    APPKEY_KEY_NAME="us-west1"
    DISK_KEY_RING_NAME="us-west1"
    DISK_KEY_NAME="us-west1"

    If this were for an eval org, the RUNTIME_LOCATION would be set to a zone instead of a region.

    You will use the variable names, such as $PROJECT_ID as string literals in your commands.

    Note that you might not use all of these environment variables during your provisioning and configuration.

  2. (Optional) Check your work by echoing the values you just set. Note that when you want to use a variable in your commands, precede the variable's name with a dollar sign ($).
    echo $PROJECT_ID
    echo $PROJECT_NUMBER
    echo $ANALYTICS_REGION
    echo $APPKEY_LOCATION
    echo $APPKEY_KEY_RING_NAME
    echo $APPKEY_KEY_NAME
    echo $DISK_KEY_RING_NAME
    echo $DISK_KEY_NAME
    

    The responses to your echo commands should look like the following:

    Authorization: Bearer ya29.a123456678940B63hPSAMPLEsampleKKYVsample0f3pWDWZDuH2-hENkNa
    TvgZ1PD977TMvv6edBQPJezdHw040880Ol_LoD5ZDkt-i-knizia_KhA9L20sSvztL81-SAMPLE42ELPMASk2_
    1CxN
    my-cloud-project
    1234567890
    us-west1
    us-west1
    us-west1
    my-app-key-ring
    my-app-key
    my-disk-key-ring
    my-disk-key
    

If you encounter errors during this part of the process, see Troubleshooting.


1 NEXT: Enable APIs 3 4 5 6 7 8 9