This topic explains how to deploy a proxy from the command line. Apigee Edge provides two options for deploying from the command line. The first is to use an Apigee Edge deploy tool written in Python. The other is to configure and run a shell script.

Use the command line deployment techniques when you are working directly with proxy source files on your system. There are many reasons why you may be working offline. You may wish to use a favorite XML editor or you may be developing policies that require Java coding and you are working primarily in an IDE. The techniques described in this section allow you to upload and deploy your source files to the API Services environment that you choose.

If you are working primarily in the management UI, see Deploying proxies in the UI.

Running the Apigee Edge Python deploy tool

The Apigee Edge Python deploy tool is a client that interacts with the Edge management API to import and deploy API proxies. The tool is available as part of the API Platform Samples distribution on GitHub. See Using the samples.

Use the Apigee Edge Python tool to import (upload) and deploy your API in one simple process.

The deploy tool must be run from the base directory in the distribution. You provide a pointer to the directory that contains the /apiproxy directory.

Substitute your username, password, and Apigee Edge organization in the following command for myname:mypass and myorg.

For example, from the base directory of api-platform-samples, run:

$ python tools/deploy.py -n weatherapi -u myname:mypass -o myorg -e test -p / -d <proxyname>

The flags are:

  • -n: The name of your API proxy
  • -u: The username and password for your account in an organization in Apigee Edge
  • -o: The name of the organization in which you have an account
  • -e: The environment to which the API proxy should be deployed (test or prod)
  • -p: The path to the directory that contains the /apiproxy directory

This single action zips your files, pushes them to your organization on Apigee Edge, and deploys them to the specified environment.

The deploy tool automatically discovers the current revision of your API proxy, undeploys the existing revision, and deploys an incremented revision of the API proxy.

On success you see, for example:

Writing ./<proxybasedir>/apiproxy/weatherapi.xml to apiproxy/weatherapi.xml
Writing ./<proxybasedir>/apiproxy/proxies/default.xml to apiproxy/proxies/default.xml
Writing ./<proxybasedir>/apiproxy/targets/default.xml to apiproxy/targets/default.xml
Imported new proxy version 1
Environment: test
  Revision: 1 BasePath = /
  State: deployed

The tool has zipped up your files, imported the package to Apigee Edge, and deployed to the 'test' environment in your Apigee Edge organization.

Configuring and running a deploy shell script

The shell script described in this section is included with the API Platform Samples distribution. For information on downloading the samples distribution, see Using the samples. This section assumes that you have obtained the shell script.

The easiest approach is to run the deploy script provided with the sample API proxy. The shell scripts wrap the Apigee Edge Python deploy tool.

From the /simplyProxy directory run:

$ sh deploy.sh

You should see:

Enter your password for user {myname} in the Apigee Enterprise organization {org_name}, followed by [ENTER]: 

Enter your password, press ENTER.

You should then see:

Deploying to test on https://api.enterprise.apigee.com using {myname} on enterprise.apigee.com and {org_name} on enterprise.apigee.com

If you see the following:

Enter your password for user Your USERNAME on enterprise.apigee.com in the Apigee Enterprise organization Your ORG on enterprise.apigee.com, followed by [ENTER]: 

it means that you need to modify the /setup/setenv.sh file in the platform samples distribution. For instructions, refer to the README or to API reference getting started.

On success, the deploy tool ZIPs up the files under /apiproxy, imports the package to your organization on Apigee Edge, and then deploys the API proxy to the 'test' environment.

Your API proxy is ready to be invoked.

Help or comments?

  • Something's not working: See Apigee Support
  • Something's wrong with the docs: Click Send Feedback in the lower right.
    (Incorrect? Unclear? Broken link? Typo?)