Step 8: Promote an archive to production

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

In this step, you'll promote an archive of your API proxy configuration to a production environment in your Apigee organization.

  1. Create a prod environment in your Apigee organization and enable archive deployment.
    1. Sign in to Apigee UI.
    2. Select Admin > Environments > Overview in the left navigation menu.
    3. Click +Environment.

      The New environment dialog displays.

    4. Enter the following information in the fields:
      Field Setting
      Display name: prod
      Environment name: prod
      Description: Production environment
      Deployment type: Archive
    5. Click Create.
  2. Create a new prod environment in your local development environment:
    1. In Apigee in VS Code, position your cursor over the environments folder in the Apigee Explorer and click Create icon.

      + displays when you position the cursor over environments folder

      The Create environment wizard opens.

    2. Enter prod for the environment name and press Enter.

      The environment is created.

    3. Expand the prod environment folder in the API Explorer to view its contents.
    4. Position your cursor over the deployments.json file in the Apigee Explorer and click Configure icon.

      The Deployments wizard opens.

    5. Select the helloworld API proxy to add it to the deployment and click OK.

      The deployments.json file is opened in the editor. The file has been updated to include the helloworld API proxy in the proxies deployment array, as shown below:

      {
        "proxies": [
           "helloworld"
        ],
        "sharedflows": []
      }
  3. Deploy an archive of your API proxy configuration to the prod environment in your Apigee organization.
    1. In the Terminal tab in Apigee VS Code, navigate to the myapigeeworkspace directory.
      cd myapigeeworkspace
    2. Run the following command:
      gcloud alpha apigee archives deploy --environment=prod --labels=release=052021.1

      The following provides an example of the response:

      Using Apigee organization dev
      Waiting for operation [$OPERATION_ID] to complete...⠹
      Archive deployment with id "vrytwbhso558oil53m" started with operation id "$OPERATION_ID"
    3. Run the following command to check the status of the operation, replacing $OPERATION_ID with the operation ID returned in the previous call:
      gcloud alpha apigee operations describe $OPERATION_ID

      The following provides an example of the response. Note that state is set to IN_PROGRESS.

      Using Apigee organization 'prod'
      done: true
      metadata:
        '@type': type.googleapis.com/google.cloud.apigee.v1.OperationMetadata
        operationType: INSERT
        state: IN_PROGRESS
        targetResourceName: uri
      name: organizations/prod/operations/$OPERATION_ID
      organization: prod
      response:
        '@type': type.googleapis.com/google.cloud.apigee.v1.CanaryEvaluation
        control: 1-5-0-20210319-071117-ghq74
        endTime: '2021-03-20T06:15:44.329363950Z'
        metricLabels:
          env: test
          location: us-central1
        name: uri
        startTime: '2021-03-20T06:14:44.306534584Z'
        treatment: 1-5-0-20210319-190954-if0wk
        verdict: NONE
      uuid: $OPERATION_ID
    4. Repeat the previous step until state is set to FINISHED indicating that the archive depoloyment is complete.
    5. Run the following command to view all archive deployments in the prod environment:
      gcloud alpha apigee archives list --environment=prod

      The following provides an example of the response:

      Using Apigee organization 'prod'
      ARCHIVE ID                        ENVIRONMENT   DEPLOYED AT           LABELS
      vrytwbhso558oil53m                prod          2021-04-20 21:20:53   release=052021.1

Congratulations! You've successfully promoted your API archive to an Apigee production environment!