Create environments

This topic explains how to create new environments. For an introduction, see About environments.

About environment creation

Environment creation is a two-step process:

  • Create an enviroment in the management plane using either the UI or an Apigee API.
  • Add configuration for that environment to your overrides file and apply it to the cluster.

The steps for adding an environment are described in adding and configuring an environment are explained in Step 5: Add an environment and Specify configuration overrides.

How to create an environment

  1. Create one or more new environments in the Apigee hybrid UI or with the Create Environments API. For the basic steps, see Step 5: Add an environment.
  2. Add a new environment definition to the envs[] property in your overrides file. Note that the property is an array; therefore, you can add more than one environment definition to it. Give the new environment the same name as the one you created in the UI. For example, the following configuration defines two environments: test and prod:

    namespace: my-namespace
    org: my-organization
    ...
    envs:
      - name: test
        serviceAccountPaths:
          synchronizer: "your_keypath/synchronizer-manager-service-account.json
          udca: "your_keypath/analytic-agent-service-account.json
    
      - name: prod
        serviceAccountPaths:
          synchronizer: "your_keypath/synchronizer-manager-service-account.json
          udca: "your_keypath/analytic-agent-service-account.json
    ...
  3. Add a virtualhosts property that maps its routingRules to the environment(s).
    virtualhosts:
      - name: default
        hostAliases: ["api.example.com"]
        sslCertPath: ./certs/fullchain.pem
        sslKeyPath: ./certs/privkey.pem
        routingRules:
          - env: test
  4. Apply any changes to the cluster. If you changed both the envs[] and virtualhosts[] properties, apply changes with the following command:
    apigeectl apply -f overrides-file.yaml -c synchronizer,udca,runtime

    If you only change the virtualhosts property, apply those config changes with the --settings flag:

    apigeectl apply -f overrides-file.yaml --settings virtualhosts

For more information about virtual host configuration, including how to configure multiple basepath routing rules, see Configure virtual hosts. For a complete list of environment configuration elements, see envs in the Configuration property reference.