Tutorial: High Availability for API Gateways in Multi-Cloud and Hybrid Environments (2024)

Multi‑cloud deployments are here to stay. According to F5’s State of Application Strategy in2022 report,77% of enterprises operate applications across multiple clouds. The adoption of multi‑cloud and hybrid architectures unlocks important benefits, like improved efficiency, reduced risk of outages, and avoidance of vendor lock‑in. But these complex architectures also present unique challenges.

The software and IT leaders surveyed by F5 named these as their top multi‑cloud challenges:

  • Visibility (45% of respondents)
  • Security (44%)
  • Migrating apps (41%)
  • Optimizing performance (40%)

Managing APIs for microservices in multi‑cloud environments is especially complex. Without a holistic API strategy in place, APIs proliferate across public cloud, on‑premises, and edge environments faster than Platform Ops teams can secure and manage them. We call this problem API sprawl and in an earlier post we explained why it’s such a significant threat.

You need a multi‑cloud API strategy so you can implement a thoughtful approach to unifying your microservices– now distributed across multiple clouds– to ensure end-to-end connectivity. Two of the common scenarios for multi‑cloud and hybrid deployments are:

  • Different services in multi‑cloud/hybrid environments– You need to operate different applications and APIs in different locations, perhaps for cost efficiency or because different services are relevant to different groups of users.
  • Same services in multi‑cloud/hybrid environments– You need to ensure high availability for the same applications deployed in different locations.

In the following tutorial we show step-by-step how to use API Connectivity Manager, part of F5 NGINX Management Suite, in the second scenario: deploying the same services in multiple environments for high availability. This eliminates a single point of failure in your multi‑cloud or hybrid production environment: if one gateway instance fails, another gateway instance takes over and your customers don’t experience an outage, even if one cloud goes down.

API Connectivity Manager is a cloud‑native, run‑time–agnostic solution for deploying, managing, and securing APIs. From a single pane of glass, you can manage all your API operations for NGINXPlus API gateways and developer portals deployed across public cloud, on‑premises, and edge environments. This gives your Platform Ops teams full visibility into API traffic and makes it easy to apply consistent governance and security policies for every environment.

Enabling High Availability for API Gateways in a Multi-Cloud Deployment

As mentioned in the introduction, in this tutorial we’re configuring API Connectivity Manager for high availability of services running in multiple deployment environments. Specifically, we’re deploying NGINXPlus as an API gateway routing traffic to two services, ServiceA and ServiceB, which are running in two public clouds, Google Cloud Platform (GCP) and Amazon Web Services (AWS). (The setup applies equally to any mix of deployment environments, including Microsoft Azure and on‑premises data centers.)

Figure1 depicts the topology used in the tutorial.

Tutorial: High Availability for API Gateways in Multi-Cloud and Hybrid Environments (1)

Follow the steps in these sections to complete the tutorial:

  • Install and Configure API Connectivity Manager
  • Deploy NGINXPlus Instances as API Gateways
  • Set Up an Infrastructure Workspace
  • Create an Environment and API Gateway Clusters
  • Apply Global Policies

Install and Configure API Connectivity Manager

  1. Obtain a trial or paid subscription for NGINX Management Suite, which includes Instance Manager and API Connectivity Manager along with NGINXPlus as an API gateway and NGINX App Protect to secure your APIs. Start a free, 30-day trial of NGINX Management Suite to get started.
  2. Install NGINX Management Suite. In the Install Management Suite Modules section, follow the instructions for API Connectivity Manager (and optionally other modules).
  3. Add the license for each installed module.
  4. (Optional.) Set up TLS termination and mTLS, to secure client connections to NGINX Management Suite and traffic between API Connectivity Manager and NGINXPlus instances on the data plane, respectively.

Deploy NGINX Plus Instances as API Gateways

Select the environments that make up your multi‑cloud or hybrid infrastructure. For the tutorial we’ve chosen AWS and GCP and are installing one NGINXPlus instance in each cloud. In each environment perform these steps on each data‑plane host that will act as an API gateway:

  1. Install NGINXPlus on a supported operating system.
  2. Install the NGINX JavaScript module (njs).
  3. Add the following directives in the main (top‑level) context in /etc/nginx/nginx.conf:

    load_module modules/ngx_http_js_module.so;load_module modules/ngx_stream_js_module.so;
  4. Restart NGINXPlus, for example by running this command:

    $ nginx -s reload

Set Up an Infrastructure Workspace

You can create multiple Infrastructure Workspaces (up to10 at the time of writing) in API Connectivity Manager. With segregated Workspaces you can apply policies and authentication/authorization requirements that are specific to different lines of business, teams of developers, external partners, clouds, and so on.

Working in the API Connectivity Manager GUI, create a new Workspace:

  1. Click Infrastructure in the left navigation column.
  2. Click the  + Create  button to create a new workspace, as shown in Figure2.

    Tutorial: High Availability for API Gateways in Multi-Cloud and Hybrid Environments (2)
  3. In the CreateWorkspace panel that opens, fill in the Name field (demo in Figure3). Optionally, fill in the Description field and the fields in the Workspace Contact Information section. The infrastructure admin (your Platform Ops team, for example) can use the contact information to provide updates about status or issues to the users of the Workspace.

    Tutorial: High Availability for API Gateways in Multi-Cloud and Hybrid Environments (3)
  4. Click the  Create  button.

Create an Environment and API Gateway Clusters

In API Connectivity Manager, an Environment is a logical grouping of dedicated resources (such as API gateways or API developer portals). You can create multiple Environments per Workspace (up to25 at the time of writing); they usually correspond to different stages of app development and deployment such as coding, testing, and production, but they can serve any purpose you want.

Within an Environment, an API Gateway Cluster is a logical grouping of NGINXPlus instances acting as API gateways. A single Environment can have multiple API Gateway Clusters which share the same hostname (for example, api.nginx.com, as in this tutorial). The NGINXPlus instances in an API Gateway Cluster can be located in more than one type of infrastructure, for example in multiple clouds.

There are two ways to configure an Environment in API Connectivity Manager for active‑active high availability of API gateways:

  • With one API Gateway Cluster
  • With multiple API Gateway Clusters

The primary reason to deploy multiple API Gateway Clusters is so that you can apply a different set of security policies to each cluster.

In Deploy NGINXPlus Instances as API Gateways, we deployed two NGINXPlus instances– one in AWS and the other in GCP. The tutorial uses the same instances to illustrate both Environment types (with a single API Gateway Cluster or with multiple API Gateway Clusters); if you want to deploy both Environment types in a single Workspace you would need to create additional NGINXPlus instances for the second Environment.

Deploy an Environment with One API Gateway Cluster

For an Environment with one API Gateway Cluster, the same security policies apply to all NGINXPlus API gateway instances, as shown in Figure4.

Tutorial: High Availability for API Gateways in Multi-Cloud and Hybrid Environments (4)
Create an Environment and API Gateway Cluster
  1. Navigate to your Workspace and click the  Create Environment  button, as shown in Figure5.

    Tutorial: High Availability for API Gateways in Multi-Cloud and Hybrid Environments (5)
  2. In the CreateEnvironment panel that opens, fill in the Name field (prod in Figure6) and optionally the Description field, and select the Environment type (here we’re choosing Prod).

    Tutorial: High Availability for API Gateways in Multi-Cloud and Hybrid Environments (6)
  3. In the API Gateway Clusters section, fill in the Name and Hostname fields (api-cluster and api.nginx.com in Figure6).
  4. Click the  Create  button.

    The EnvironmentCreated panel opens to display the command you need to run on each NGINXPlus instance to assign it to the API Gateway Cluster. For convenience, we show the commands in Step7 below.

Assign API Gateway Instances to an API Gateway Cluster

Repeat on each NGINXPlus instance:

  1. Use ssh to connect and log in to the instance.
  2. If NGINX Agent is already running, stop it:

    $ systemctl stop nginx-agent
  3. Run the command of your choice (either curl or wget) to download and install the NGINX Agent package:

    • If you didn’t enable mTLS in Install and Configure API Connectivity Manager, add:

      • The ‑k flag to the curl command
      • The --no-check-certificate flag to the wget command
    • For <NMS_FQDN>, substitute the IP address or fully qualified domain name of your NGINX Management Suite server.
    • For <cluster_name>, substitute the name of the API Gateway Cluster (api-cluster in this tutorial).
    $ curl [-k] https://<NMS_FQDN>/install/nginx-agent > install.sh && sudo sh -install.sh -g <cluster_name> && sudo systemctl start nginx-agent

    or

    $ wget [--no-check-certificate] https://<NMS_FQDN>/install/nginx-agent --no-check-certificate -O install.sh && sudo sh install.sh -g <cluster_name> && sudo systemctl start nginx-agent

    The NGINXPlus instances now appear in the Instances section of the Cluster window for api-cluster, as shown in Figure7.

    Tutorial: High Availability for API Gateways in Multi-Cloud and Hybrid Environments (7)
  4. Proceed to Apply Global Policies.

Deploy an Environment with Multiple API Gateway Clusters

For an Environment with multiple API Gateway Clusters, different security policies can apply to different NGINXPlus API gateway instances, as shown in Figure8.

Tutorial: High Availability for API Gateways in Multi-Cloud and Hybrid Environments (8)
Create an Environment and API Gateway Cluster
  1. Navigate to your Workspace and click the  Create Environment  button, as shown in Figure9.

    Tutorial: High Availability for API Gateways in Multi-Cloud and Hybrid Environments (9)
  2. In the CreateEnvironment panel that opens, fill in the Name field (prod in Figure10) and optionally the Description field, and select the Environment type (here we’re choosing Prod).

    Tutorial: High Availability for API Gateways in Multi-Cloud and Hybrid Environments (10)
  3. In the API Gateway Clusters section, fill in the Name and Hostname fields (in Figure10, they are aws-cluster and api.nginx.com).
  4. Click the  Create  button.

    The EnvironmentCreated panel opens to display the command you need to run on each NGINXPlus instance to assign it to the API Gateway Cluster. For convenience, we show the commands in Step10 below.

  5. Navigate back to the Environment tab and click the  + Add  button in the upper right corner of the API Gateway Clusters section, as shown in Figure11.

    Tutorial: High Availability for API Gateways in Multi-Cloud and Hybrid Environments (11)
  6. On the Create API Gateway Cluster panel, fill in the Name field with the second cluster name (gcp-cluster in Figure12) and the Hostname field with the same hostname as for the first cluster (api.nginx.com).

    Tutorial: High Availability for API Gateways in Multi-Cloud and Hybrid Environments (12)

The two API Gateway Clusters now appear on the API Gateway Clusters for the Prod Environment, as shown in Figure13.

Tutorial: High Availability for API Gateways in Multi-Cloud and Hybrid Environments (13)
Assign API Gateway Instances to an API Gateway Cluster

Repeat on each NGINXPlus instance:

  1. Use ssh to connect and log in to the instance.
  2. If NGINX Agent is already running, stop it:

    $ systemctl stop nginx-agent
  3. Run the command of your choice (either curl or wget) to download and install the NGINX Agent package:

    • If you didn’t enable mTLS in Install and Configure API Connectivity Manager, add:

      • The ‑k flag to the curl command
      • The --no-check-certificate flag to the wget command
    • For <NMS_FQDN>, substitute the IP address or fully qualified domain name of your NGINX Management Suite server.
    • For <cluster_name>, substitute the name of the appropriate API Gateway Cluster (in this tutorial, aws‑cluster for the instance deployed in AWS and gcp‑cluster for the instance deployed in GCP).
    $ curl [-k] https://<NMS_FQDN>/install/nginx-agent > install.sh && sudo sh -install.sh -g <cluster_name> && sudo systemctl start nginx-agent

    or

    $ wget [--no-check-certificate] https://<NMS_FQDN>/install/nginx-agent --no-check-certificate -O install.sh && sudo sh install.sh -g <cluster_name> && sudo systemctl start nginx-agent

    The appropriate NGINXPlus instance now appears in the Instances section of the Cluster windows for aws‑cluster (Figure14) and gcp‑cluster (Figure15).

    Tutorial: High Availability for API Gateways in Multi-Cloud and Hybrid Environments (14)
    Tutorial: High Availability for API Gateways in Multi-Cloud and Hybrid Environments (15)

    Apply Global Policies

    Now you can add global policies which apply to all the NGINXPlus instances in an API Gateway Cluster. For example, to secure client access to your APIs you can apply the OpenID Connect Relying Party or TLSInbound policy. To secure the connection between an API gateway and the backend service which exposes the API, apply the TLSBackend policy. For more information about TLS policies, see the API Connectivity Manager documentation.

    1. Navigate to the Cluster tab for the API Gateway where you want to apply a policy (api-cluster in Figure16). Click the Manage button that’s above the right corner of the Policies table.

      Tutorial: High Availability for API Gateways in Multi-Cloud and Hybrid Environments (16)
    2. Click GlobalPolicies in the left navigation column, and then the icon in the rightmost column of the row for the policy (TLSBackend in Figure17.) Select + Add Policy from the drop‑down menu.

      Tutorial: High Availability for API Gateways in Multi-Cloud and Hybrid Environments (17)

    Conclusion

    Managing multi‑cloud and hybrid architectures is no easy task. They are complex environments with fast‑changing applications that are often difficult to observe and secure.

    With the right tools, however, you can avoid vendor lock‑in while retaining the agility and flexibility you need for delivering new capabilities to market faster. As a cloud‑native tool, API Connectivity Manager from NGINX gives you the scalability, visibility, governance, and security you need to manage APIs in multi‑cloud and hybrid environment.

    Start a30‑day free trial of NGINX Management Suite, which includes access to API Connectivity Manager, NGINXPlus as an API gateway, and NGINX App Protect to secure your APIs.

Tutorial: High Availability for API Gateways in Multi-Cloud and Hybrid Environments (2024)

FAQs

Can you have multiple API gateways? ›

There are many benefits of using multiple API gateways for both external and internal traffic. For external traffic, benefits realized can include: Authentication, authorization, and auditing — ensuring only valid users have access to Vanguard APIs and enforcing the standard in a centralized way.

What is hybrid API management? ›

With the move towards the digital enterprise where more and more data is exposed via APIs, organizations heavily depend on API management platforms to ease the burden of managing these APIs. In hybrid API management, some parts of the platform are cloud-based and the rest is based on-premises.

What is API gateway in cloud computing? ›

An API gateway is an application programming interface (API) management tool that sits between a client and a collection of backend services.

How does API gateway work in microservices? ›

An API gateway is a server (or L7 proxy) between a client and microservices that acts as a centralized entry point for all clients into the system. It is a reverse proxy that accepts client API calls and forwards them to the appropriate microservice (refer to Fig. A below).

How many requests can API Gateway handle? ›

What are the default throttling limits in AWS API Gateway? Here are the default limits: Account-Level Throttling: Each account can handle up to 10,000 requests per second, with a burst limit of 5,000 requests per second.

How much traffic can API Gateway handle? ›

For example, API owners can set a rate limit of 1,000 requests per second for a specific method in their REST APIs, and also configure Amazon API Gateway to handle a burst of 2,000 requests per second for a few seconds. Amazon API Gateway tracks the number of requests per second.

What is the difference between API management and API gateway? ›

Relationship and Key Differences Between API Gateway and API Management. In a word, the API gateway is a core element of the API management platform. While the gateway handles API traffic routing and security, the management platform covers the entire API lifecycle, ranging from API design to API monetization.

Which is best API management? ›

Top 8 API Management Tools in 2024
  • Kong.
  • Apigee.
  • Tyk.
  • IBM API Connect.
  • Amazon API Gateway.
  • Azure API Management.
  • Gravitee.
  • WSO2 API Manager.
Mar 14, 2024

Which of the following are benefits of hybrid API management? ›

Better security and com pliance : API calls and payload data does not leave your network. This results in better security and compliance. Effective connectivity : Since you can deploy the gateway anywhere including on your own network, there is no need for VPN or any other network connectivity solution.

Is AWS an API gateway? ›

Amazon API Gateway is an AWS service for creating, publishing, maintaining, monitoring, and securing REST, HTTP, and WebSocket APIs at any scale. API developers can create APIs that access AWS or other web services, as well as data stored in the AWS Cloud .

Which API gateway is best for microservices? ›

KrakenD. KrakenD stands out in the API management field with its high-performance, stateless architecture designed for a seamless microservices adoption. It differentiates itself by not just forwarding requests to backend services but by offering extensive data transformation, aggregation, and filtering capabilities.

What is the point of an API gateway? ›

The purpose of an API gateway

An API gateway accepts client calls, routes them to the appropriate service with request routing, composition, and protocol translation, and then delivers the correct, consolidated information to clients.

What are the best practices for API gateway architecture? ›

Best practices for implementing the API gateway pattern

Use the API gateway to perform tasks such as authentication, rate limiting, and caching to improve the performance and security of the microservices. Use a decentralized approach to routing, where each microservice is responsible for its own routing.

What's the difference between a load balancer and an API gateway? ›

While API gateways specialize in API management and security, load balancers excel at distributing traffic for improved availability and scalability. Understanding their differences is essential for designing resilient and efficient systems that meet the evolving demands of modern applications and services.

How to create an API gateway? ›

Create an HTTP API by using the AWS Management Console
  1. Open the API Gateway console .
  2. Choose Create API.
  3. Under HTTP API, choose Build.
  4. Choose Add integration, and then choose an AWS Lambda function or enter an HTTP endpoint.
  5. For Name, enter a name for your API.
  6. Choose Review and create.
  7. Choose Create.

Can you use multiple APIs at once? ›

You can access as many APIs as your application requires using a single account API key and SDK. There are multiple APIs that you can use for your app-building. Some of the top APIs included on this platform is Twilio, Microsoft, Google, SendGrid, TeleSign, and many more.

Can you have both API gateway and load balancer? ›

Both services can function together, although they do not require each other to work. For instance, the API gateway connects between microservices. The load balancer redirects multiple instances of a microservice component (to scale the deployment).

Can API gateway have multiple stages? ›

You can use the API Gateway console to create a new stage, or you can choose an existing stage while deploying an API. In general, you can add a new stage to an API deployment before redeploying the API.

Can an API have more than one endpoint? ›

Working with multiple API endpoints. To enable use of sessions for multiple API endpoints, you need to use the sessionTokenBackendDomain config on the frontend and cookieDomain on the backend Session. init function call.

Top Articles
Latest Posts
Article information

Author: Virgilio Hermann JD

Last Updated:

Views: 6587

Rating: 4 / 5 (41 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Virgilio Hermann JD

Birthday: 1997-12-21

Address: 6946 Schoen Cove, Sipesshire, MO 55944

Phone: +3763365785260

Job: Accounting Engineer

Hobby: Web surfing, Rafting, Dowsing, Stand-up comedy, Ghost hunting, Swimming, Amateur radio

Introduction: My name is Virgilio Hermann JD, I am a fine, gifted, beautiful, encouraging, kind, talented, zealous person who loves writing and wants to share my knowledge and understanding with you.