Step 8: Deploy a sample proxy

What you're doing in this step

With Apigee now set up and your runtime instance in place, you can deploy a sample proxy. For this step, there are different processes for deploying and requesting the API proxy, depending on whether you chose internal or external access for your runtime in Step 7: Configure routing.

Perform the step

To deploy the example proxy:

  1. (Optional) Set up a DNS entry for your host.

    If you do not do this, then you have to send requests to an IP address instead of a friendly URL to hit your newly deployed API proxy.

    To make accessing your proxy easier, try the following techniques:

    • Add the IP and hostname to your hosts file.
    • Define friendlier hostnames on your environment and then use Cloud DNS to map a URL to an IP address.
  2. If you allowed external access to the API proxy:

    1. Open the Apigee provisioning wizard if it is not currently open. The wizard returns to the most recent incomplete task in the list.
    2. In the Recommended next steps view, click Deploy API.

      Apigee starts deploying a sample API proxy called "Hello World".

    3. Wait three to four minutes.

      The deployment process is asynchronous and, depending on the number of instances, it can take several minutes for the API proxy to be rolled out across the entire cluster.

      You can check the status of the deployment using the Deployments API.

    4. After waiting a few minutes, or confirming that the deployment process is complete, test the API proxy by sending the following request:
      curl -i -H "Host:YOUR_ENV_GROUP_HOSTNAME" \
        https://PUBLIC_FACING_IP/hello-world

      Where:

      • The value of the Host header (YOUR_ENV_GROUP_HOSTNAME) is the hostname that you defined on the environment group in Step 6: Create an environment.
      • PUBLIC_FACING_IP is the IP address of the load balancer that acts as a gateway to your instance. You can get this value from the wizard.

      Be sure to include the -k switch to instruct curl to skip authentication in a testing scenario such as this. Without this option, you will get a security error.

    The response to a successful request should look like the following:

    HTTP/2 200
    user-agent: curl/7.64.1
    accept: */*
    x-cloud-trace-context: 64a52e6SAMPLE75647424242c981905e/13734264850044428201
    x-forwarded-for: 66.31.131.162, 34.107.161.149,10.138.0.3
    x-forwarded-proto: https
    x-request-id: 42454071-9080-4431-bef3-22918fd00ddb
    x-b3-traceid: 29SAMPLEe5c045ed860463c085fca
    x-b3-spanid: 5ed860463SAMPLE
    x-b3-sampled: 0
    content-length: 11
    access-control-allow-origin: *
    access-control-allow-headers: origin, x-requested-with, accept
    access-control-max-age: 3628800
    access-control-allow-methods: GET, PUT, POST, DELETE
    content-type: text/plain
    date: Mon, 20 Jul 2020 18:53:38 GMT
    server: apigee
    via: 1.1 google, 1.1 google
    alt-svc: clear
    
    Hello world%

    If your request is not successful, see Troubleshooting.

  3. If you allowed internal access only to the API proxy, see Accessing a privately deployed API proxy.

Note that in the procedures above:

  • If you set up your load balancer with DNS, then use the hostname instead of the IP address of the target machine. For example:

    curl -i -H "Content-Type: application/json"
      "https://YOUR_ENV_GROUP_HOSTNAME/hello-world"
  • Google recommends changing your environment group hostname to something more meaningful to you. You can do this with the Environment Groups UI in Apigee UI.

    When you change it, be sure to use it for the value of hostname (rather than "test-group"), as the following example shows:

    curl -i -k -H "Host:YOUR_ENV_GROUP_HOSTNAME"
      "https://PUBLIC_LOAD_BALANCER_IP/$PROXY_BASEPATH"

Next steps