Create a Usage Plan
Each instance of an API Product in an Environment defines Usage Plans specifying the tiers of access given to API clients, including how clients are authenticated and rate limited to the APIs they consume.
In this guide we are going to create a Usage Plan for an existing API Product version through the Admin Dashboard. Users and groups will be associated with the Usage Plan in a separate guide.
Pre-requisites
You will need to have Gloo Portal deployed on a Kubernetes cluster, and a connection to the Admin Dashboard as described in the Using the Admin Dashboard guide.
You will also need the following items provisioned in Gloo Portal:
You can follow the guides linked above to perform the actions through the Admin Dashboard or go through the Getting started guide to provision these resources using kubectl.
Create a Usage Plan
Usage Plans are created from the context of an API Product version in an Environment. We will open an existing API Environment, select the API Product we want to update, and create the plan from the Plans tab in the product’s properties.
We will start from the Overview page of Gloo Portal. First you will click on the APIs item in the navigation bar to manage API Docs, Products, Routes, and more.
The page should load on the API Environments category by default. Select the Development 2 API Environment you created in an earlier guide, or another existing Environment you have available.
Expand the environment properties in the left pane so you can see the Petstore Product v2 API Product, and click on it to view its properties.
In the properties of the API Product, select the Plans tab and click on Create a Plan.
In the dialog box that pops up, we can fill out the necessary fields.
In our example we are going to use the following values:
- Name: basic
- Display Name: Basic
- Requests: 5
- Time: Minute
The Auth Policy field only supports the value API Key for the moment. Future versions of Gloo Portal will support alternative auth policies.
Click on Create Plan to complete the process. The Usage Plan will now appear under the Plans tab.
We created a Usage Plan that uses the API Key authentication policy and limits requests to five per minute. Once a user or group is associated with this plan, they will be able to provision an API Key and access the API Product version in this Environment.
Next steps
Now that you have successfully created a Usage Plan for an API Product, the next step in the process is to associate users and groups with the Usage Plan and test their access.