Upstreams per API
Adding a Flex Gateway API Instance
After you have created an API using Design Center or any other application, you can then manage that API in API Manager by adding an API instance. API instances remain under management until you delete them.
Use Flex Gateway for any APIs that need a flexible and performant API gateway that works with distributed and microservices environments and fits into your CI/CD environments.
There are three options for adding an API instance:
-
Add a new API: Select this option to add a completely new instance of an API.
-
Promote API from environment: Select this option if you have an API instance in a different environment, for instance the sandbox environment, and you want to promote it to the current or production environment.
-
Import API from zip file: Select this option if you have exported an API instance from a different Anypoint Platform instance.
When you are promoting or importing an API instance, you do not have options to alter the configuration. However, when you add a new API instance, you need to the downstream and the upstream configuration settings.
The following diagram shows the relationship of the upstream and downstream configurations settings to your upstream service and the downstream consumer application. In this configuration, the downstream service is the service making API requests that are completed by the upstream service. These terms represent the direction of dependency, not the direction of information. A downstream service could make a POST
request where it provides information to the upstream service. However, the downstream service is still dependent on the upstream service to complete the request.
Add a New API
-
Navigate to Anypoint Platform > API Manager.
-
In API Administration, click Add API and select Add new API.
-
Select Flex Gateway.
-
Select a connected Flex Gateway you have installed and registered from the list under Select a gateway.
If you do not see a Flex Gateway listed, or you see a Flex Gateway but its status is DISCONNECTED, See Install Flex Gateway and Register and Run in Connected Mode for more information.
-
Click Next.
-
Select an API from the following options:
-
Click Select API from Exchange if you have an API shared with you through Exchange that you want to manage.
-
Click the API from the list under Select API. You can search for a specific API if needed.
-
Update the Asset type, API version, and Asset version if you are not using the latest version.
For more information about versions in Exchange, see Asset Versions.
-
If you chose a RAML/OAS asset type, view the Conformance Status of the API to ensure the API is conformant. If the Conformance Status is nonconformant, after deployment, view the Governance Report to find and fix the conformance issues. For more information about the Governance Report, see Governing API Instances.
-
-
Click Create new API:
-
Enter a Name for the new API asset.
-
Select the Asset type from the following options:
-
REST API: Select this option if you have a RAML or OAS API definition file you want to include for your asset.
Upload either a RAML or OAS file for your REST API. Versions 2.0.0 and later are the recommended versions for OAS or RAML specs, because these versions add native OAS support. If you upload an OAS API specification to an API proxy version 1.0 or earlier, your API specification is translated to RAML.
-
HTTP API: Select this option if you do not have an API definition file you want to include for your asset.
-
-
Update the Asset type, API version, and Asset version if you are not using the latest version.
For more information about versions in Exchange, see Asset Versions.
-
If you chose a RAML/OAS asset type, view the Conformance Status of the API to ensure the API is conformant. If the Conformance Status is nonconformant, after deployment, view the Governance Report to find and fix the conformance issues. For more information about the Governance Report, see Governing API Instances.
-
-
-
Click Next.
-
Configure the downstream configuration settings:
Field Name Description Required Notes Protocol
Specifies whether to use HTTP or HTTPS.
Yes
If you select HTTPS, specify a TLS context for inbound traffic.
Inbound TLS
TLS Context used for the inbound traffic of HTTPS APIs
No
Configure a TLS Context for Flex Gateway before adding a TLS Context to your API. Only available on Flex 1.4.0+.
Port
Specifies the number to use if the displayed port is incorrect.
No
API instances can share the same port across the same target if the Base path is different for both instances. Only available on Flex 1.2.0+.
Base path
Specifies the URL prefix for all API paths, relative to the host root. It must start with a leading slash
/
.Yes
Instance label
Specifies a label for the API.
No
If you have multiple managed instances of the same API, add a label to differentiate each instance from the others.
Advanced Options
Consumer endpoint
Specifies a proxy application’s address for consumers to use for sending requests.
No
Client provider
Specifies a client provider for the API.
No
Anypoint Platform acts as the client provider by default. To configure an external client provider, see Client Providers.
-
Click Next.
-
Configure one of the following upstream configurations:
-
Single Upstream Service
For Flex Gateway versions 1.4.x or earlier or Flex Gateway version 1.5.x with a single upstream service, configure the following upstream configuration settings:Field Name Description Required Notes Upstream URL
URL to access for the proxy or API. This must end with a
/
.Yes
For example, you can use the URL of your API asset in Exchange.
Outbound TLS
TLS Context used for the outbound traffic to the upstream service
No
Configure a TLS Context for Flex Gateway before adding a TLS Context to your API. Only available on Flex 1.4.0+.
-
Multiple Upstream Services
Flex Gateway version 1.5.x or later supports API instances that expose multiple upstream services through a single consumer endpoint.
To configure multiple upstream services, see Multiple Upstream Services for Flex Gateway Running in Connected Mode.
-
-
Click Next.
-
Review your selections and edit them if necessary.
-
If you are ready to deploy, click Save & Deploy. Otherwise, you can select Save, to save the API instance and deploy it at a later time.
Multiple Upstream Services for Flex Gateway Running in Connected Mode
Flex Gateway version 1.5.x or later supports API instances that expose multiple upstream services through a single consumer endpoint.
Flex Gateway manages request traffic by using different routes that can each direct traffic to multiple upstream services. Flex Gateway directs traffic to the routes by using the route order and the individual route’s rules. Additionally, you can add a weighted percentage to each upstream service within a route to manage the percentage of requests sent to the upstream service.
In the following diagram, different routes manage requests to flight information databases and to a customer service application. Route one has two upstream services defined, which direct 70% of requests to a stable database and 30% of requests to a beta database.
Limits
Limit | Value | Notes |
---|---|---|
50 |
Each API supports 50 upstreams. The 50 upstreams can consist of a combination of different routes. |
|
Routes per API |
50 |
Each API supports 50 routes. |
Upstreams per route |
10 |
|
Headers per route rule |
10 |
| Field Name | Description | Required | Notes
| Upstream URL | URL to access for the proxy or API. This must end with a /
. | Yes | For example, you can use the URL of your API asset in Exchange.
| Upstream Label | Label for the upstream service | No | If you have multiple upstream service instances, add a label to each one to differentiate it from the others.
| TLS | TLS context used for the outbound traffic to the upstream service | No | Configure a TLS Context for Flex Gateway before adding a TLS context to your API. Add a TLS context by clicking Add TLS Context.
| Weight | Percentage of requests to send to that upstream service | Yes | This value is configurable only if you have multiple upstream services. The sum of all upstream weights must equal 100%
.