Create and deploy a new API proxy

Now that you've configured Google Cloud and the hybrid UI, and installed and configured the runtime, you're ready to see how it all works together.

This section walks you through the following:

  1. Create a new API proxy in the Apigee UI using the API Proxy Wizard
  2. Deploy your new proxy to your cluster with the UI

1. Create a new API proxy using the hybrid UI

This section describes how to create a new API proxy in the UI by using the API Proxy Wizard.

To create a simple API proxy using the API Proxy Wizard:

  1. Open Apigee UI in a browser.
  2. Select Develop > API Proxies in the main view.
  3. From the Environment drop-down list, select the environment in which you want to create a new API proxy. This section assumes the name of the environment is "test". You created at least one environment in Step 5: Add an environment.

    The hybrid UI displays a list of API proxies for that environment. If you haven't created any proxies yet, the list is empty.

  4. Click +Proxy in the upper right. The API Proxy Wizard starts.
  5. Select Reverse proxy (most common), and click Next.

    The Proxy details view is displayed.

  6. Configure your proxy with the following settings:
    • Proxy Name: Enter "myproxy". The remaining steps in this section assume that this is your proxy's ID.
    • Proxy Base Path: Automatically set to "/myproxy". The Proxy Base Path is part of the URL used to make requests to your API. Edge uses the URL to match and route incoming requests to the proper API proxy.
    • (Optional) Description: Enter a description for your new API proxy, such as "Testing Apigee hybrid with a simple proxy".
    • Target (Existing API): Enter "https://mocktarget.apigee.net". This defines the target URL that Apigee invokes on a request to the API proxy. The mocktarget service is hosted at Apigee and returns simple data. It requires no API key or access token.

    Your API proxy's details should look like the following:

  7. Click Next.
  8. On the Policies screen, select Pass through (no authorization) as the security option.
  9. Click Next.
  10. On the Summary screen, click Create.

    Hybrid generates the proxy (sometimes referred to as the proxy bundle):

  11. Click Go to proxy list.

    Hybrid displays the Proxies view, which displays a list of API proxies. The new proxy should be at the top of the list, with a gray status indicator, meaning that it has not yet been deployed.

2. Deploy your proxy to the cluster using the hybrid UI

After creating a new proxy, you must deploy it so that you can try it out. This section describes how to deploy your new proxy using the hybrid UI.

To deploy an API proxy in the hybrid UI:

  1. In the hybrid UI, select Develop > API Proxies.

    Be sure the "test" environment is selected.

    The UI displays your new proxy in the proxies list:

  2. Click on the "myproxy" proxy.

    The UI displays the API Proxies Overview tab for that proxy.

    Notice that under Deployments, the Revision column shows "Not deployed".

  3. In the Revision column, expand the drop-down selector to choose the revision to deploy.

    The drop down list displays only "1" and "Undeploy".

  4. Select "1"—the revision that you want to deploy—from the drop down list.

    The UI prompts you to confirm the deployment:

  5. Click Deploy.

    The UI begins the process of deploying revision 1 of your new proxy to the cluster.

    Note that deployment is not an instantaneous process. Hybrid's "eventually consistent" deployment model means that a new deployment will be rolled out to the cluster over a short period of time and not immediately.

While there are several ways to check the deployment status of a proxy in the UI, the next two steps explain how to call the API proxy you just deployed and how to check the deployment status with a call to the Apigee APIs.

3. Call the API proxy

Follow the steps below, depending on whether or not you can update the DNS record of the hostname you used to create the environment group.

If you are unable to update your hostname's DNS

Follow these steps if your environment group hostname is not registered, or you are not able to update its DNS record. In these steps, you get the ingress IP and use it directly in a cURL call with the --resolve flag:

  1. Export the ingress IP:
    export INGRESS_IP=$(kubectl -n istio-system get service \
      istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
  2. Export the secure ingress port number:
    export SECURE_INGRESS_PORT=$(kubectl -n istio-system get \
      service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].port}')
  3. Export your environment group's host alias to a variable:
    export HOSTALIAS=your_host_alias
  4. Call the API proxy. The --resolve flag on cURL allows you to directly specify the ingress IP:
    curl  -H Host:$HOSTALIAS --resolve \
      $HOSTALIAS:$SECURE_INGRESS_PORT:$INGRESS_IP  \
      https://$HOSTALIAS:$SECURE_INGRESS_PORT/myproxy -k

If you are able to update your hostname's DNS

Follow these steps if the hostname you used when you created the environment group is registered and you can update its DNS record to point to the external ingress IP:

  1. Export the external IP of the ingress to a variable:
    export INGRESS_IP=$(kubectl -n istio-system get service \
      istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
  2. Check that the variable holds the IP address. For example:
    echo $INGRESS_IP
    34.118.196.202
  3. Use this IP address to update your DNS record (usually an A or CNAME record) at your registrar or DNS provider. You may have to wait up to an hour for the DNS record change to propagate.
  4. Export your environment group's host alias to a variable:
    export HOSTALIAS=your_host_alias
  5. Call the API proxy:
    curl -k https://$HOSTALIAS/myproxy

    For example:

    curl -v -k https://apitest.acme.com/myproxy

    If the call succeeds, you will see the following output:

    Hello, Guest!