Step 5. Deploy the API to CloudHub | MuleSoft Documentation
# Step 5. Deploy the API to CloudHub
Now that you’ve created and tested the Mule app that contains your new API from within Studio, you can deploy the API to CloudHub. First, create an API proxy, which then enables you to test the API from Exchange. Then, set up a rate-limiting policy to protect your API from a denial-of-service attack.
## Step 5.1: Deploy API to CloudHub
To deploy this API in the form of a Mule app:
  1. From Studio, in the Mule Design perspective, right-click the `hello-world-app` project in Package Explorer, and then select **Anypoint Platform > Deploy to CloudHub**.
  2. If prompted, enter your Anypoint Platform username and password and click **Sign in**.
  3. You must be in your account’s sandbox to deploy the API. If you see **Design** instead of **Sandbox** :
    1. Click **Design** to launch the Switch Environment dialog.
    2. Click **Sandbox** , and then click **Switch**.
  4. In Deploying Application, enter `hello-world-greeting-firstname-lastname` for the app name. Every app and API name must be unique across CloudHub. This example uses `hello-world-greeting-sandy-kim`.
  5. For **Deployment Target** , select **CloudHub**.
  6. Don’t change any of the other default values.
  7. Click **Deploy Application**. After a brief pause, a window displays the status of the deployment.
  8. Click **Open in Browser** to see the status displayed in Runtime Manager.
When the project is successfully deployed, Runtime Manager displays the status **Started**.
  9. To test the API deployment, send a request from Advanced Rest Client:
    1. Click **Started** to display the **App url**.
    2. Copy the app URL value, which in this case is `hello-world-greeting.sandy-kim.us-e2.cloudhub.io`. + This URL is also be used later when you configure the proxy API. +
    3. In Advanced Rest Client, send a request to the base URI that you just copied. Be sure to add the API endpoint `/api/greeting`:
```
GET http://hello-world-greeting.sandy-kim.us-e2.cloudhub.io/api/greeting
```

    4. If you see `200 OK` and the greeting you specified, `Today the greeting is Hello.`, then you have successfully deployed the API you created.


Now you need to create an API proxy application for this API, to restrict access and keep the service protected. You will add a rate-limiting policy, which you can do while the API is running.
## Step 5.2: Create and Deploy an API Proxy Application
You must add your API to API Manager and create an API proxy before you add a rate limit policy to your endpoint.
  1. Log in to Anypoint Platform.
Take me to Anypoint Platform
  2. Click **API Manager**.
  3. Click **Sandbox** to switch to the sandbox environment.
  4. Select **Add API > Add new API**.
  5. In the New API page, select **Mule gateway** and select the following values:
     * For **Proxy type** , select **Deploy a proxy application**.
     * For **Target type** , select **CloudHub**.
  6. For **Proxy app name** , which is the name displayed in Runtime Manager, enter **hello-world-greeting-proxy** and append your last name or another unique string to ensure the proxy name is unique, and then click **Next**.
  7. Click **Select API from Exchange** if it’s not already selected.
  8. In the **Select API** search box, enter `hello` and select **hello-world-api** from the drop-down. Here, you are working with the API, not the deployed app named `hello-world-greeting`.
  9. Leave the following default values and click **Next**.
     * **Asset type: RAML/OAS**
     * **API version: v1 (Latest)**
     * **Asset version: 1.0.0**
  10. In the **Downstream** page, accept the defaults and click **Next**.
  11. In the **Upstream page** , enter the upstream URL, and click **Next**.
The upstream URL is the **App url** from the deployed app in Runtime Manager.
  12. Click **Next**.
  13. Review the selections for the API instance, and then click **Save & Deploy**.
  14. After the API instance is deployed, a confirmation message appears with a link to Anypoint Runtime Manager. Click the link to view the details of your API instance


Now that your API is managed in API Manager, you can create a proxy in the next step.
## Step 5.3. Configure the API Proxy
Now you have an implementation URL that you don’t want to share with the world, and a proxy URL that is safe to share with the world after you configure it.
To configure the proxy:
  1. In **Anypoint Manager > API Administration**, click the **hello-world-api** link.
  2. In **API Summary** , right-click the **Proxy URL** link and copy it.
  3. Click the pencil icon to edit the API instance.
  4. In the **Downstream** section, paste the link you just copied to **Consumer endpoint** , and then click **Save & Apply**.


Now you can test the proxy endpoint from Exchange:
  1. Select **Actions > View API in Exchange**.
  2. Click the Expand icon, then click **Manage versions**.
You can see the Mocking Service version and the new proxy you just created in the Sandbox environment.
  3. Click **Close**.
  4. Click **/greeting** to open, then click **GET**.
  5. In **Select server** , expand the menu and select **Sandbox - v1: <version>**:
  6. Click **Send**. The response should be `200 OK` with the greeting `Today the greeting is Hello.`


Finish configuring the proxy:
  1. Click **Home** to return to the API summary.
  2. Click **Share**.
  3. In the **Share** dialog, click **Public** and then select the API version to make available on the public Exchange portal:
  4. Click **Save**.


## Step 5.4: Add a Rate Limit Policy
To add a rate limit policy:
  1. Return to API Manager.
  2. In **API Administration** , click the **hello-world-api** link.
  3. In the navigation, click **Policies**.
  4. Click **Add policy**.
  5. Scroll to the **Quality of service** section, select **Rate limiting** (not **Rate limiting - SLA based**), and click **Next**.
  6. In the **Configure Rate limiting policy** page, set the rate limit values:
     * **Number of Requests** : `3`
     * **Time Period** : `1`
     * **Time Unit** : **Minute**
  7. Select **Expose Headers**.
  8. In the **Advanced options** section, select the latest version.
  9. Select **Method & Resource conditions**: **Apply configurations to all API methods & resources**, and then click **Apply**.


The new policy is displayed on the Policies home page.
Change the API instance label so it reflects the fact that you now have a policy on the proxy:
  1. In the navigation, click **API Summary**.
  2. Click the pencil icon and change the value for **Instance Label** to `Rate-limiting policy`.
  3. Click **Save & Apply**.


Test the new policy:
In Advanced Rest Client, send GET requests to the API proxy `http://hello-world-greeting-proxy.us-e2.cloudhub.io/greeting` (the consumer endpoint plus `/greeting`) multiple times, until you receive the response `429 Too Many Requests`.
## What’s Next
Now that your API is deployed as a Mule app to Mule in CloudHub, you can manage it using Anypoint Platform tools.
## Developer Deep Dive
MuleSoft provides many deployment options, described in Deploy Mule Applications.