Using Gelato with Kong

It's easy to integrate Gelato with the Kong API Management Gateway, and it's a great way to offer a seamless onboarding experience for your developers.

This guide is a quick overview of how to get Gelato and Kong connected. We'll start with a quick example of where we want to get to - of the Developer Experience for a Gelato Portal connected to Kong!

The Gelato + Kong Experience!

With an integrated portal, Gelato can create API credentials for your registered Developers automatically. This is what that looks like:

Here you can see the Gelato API Explorer for our sample "Cat Pictures" API. The developer makes a request without an API key, and there's an authentication failure.

Next, the developer clicks "Get API Key". Under the covers, this is creating a new Kong Consumer and associated key-auth credentials.

That means the next time the developer makes a request, they get their 200 OK and their desired cute kitty picture!

You've just onboarded a new developer in ~10 seconds.

Next, let's learn how to set this up for your API.

Before You Start

  • You'll need to have Kong installed and running on a server that's accessible on the internet (i.e not your local machine). There are Installation Instructions available on the Kong site, and you can always drop us a line. If you don't have a server immediately available, Amazon EC2, Digital Ocean or similar are all very good options.
  • Make sure you have at least one API configured in Kong, along with authentication. You can read more about configuring APIs in the Kong Documentation
  • You should ensure that the curl program is available on your server. Usually it'll come preinstalled, or it can be installed easily via your package manager (apt-get curl for example).

You can check that both Kong and curl are installed and functioning by running the following command:

$> curl http://localhost:8001

You should get some JSON including the tagline: "Welcome to Kong!"

Connection Process

Kong offers a really simple Admin API for Gelato to connect to. By default, the API is available on http://localhost:8001. In order for Gelato to connect to the API via the Internet it needs to be available publicly, and because it's an Admin API, we want to make sure that it's accessed securely.

It turns out that we have a really great tool for proxying and securing APIs already - Kong itself! So the connection process involves creating a "loop-back" for the Kong Admin API.

You can set up this connection really easily by logging into your Gelato Admin panel, and choosing the Portal Settings tab. Scroll to "Kong Integration" and click "Connect Now".

Now you'll see a "Connect to Kong" screen with a generated API Key, a shell command to run, and a field for you to specify the location of your Kong server.

You should copy and run that command on the Kong server you created above. It will output something like the following:

(If you'd like to read more about what that shell script is doing, or if you'd prefer to run the command manually, check out our Advanced Kong Integration guide).

Now all we need to do is specify the public URL for the server that Kong is running on. For instance, if you've used an Amazon EC2 instance, this will be something like: ec2-42-11-255-17.compute-1.amazonaws.com.

Now click "Connect to Kong". If we can connect to your Kong instance from Gelato, you'll see a happy message:

(If you have trouble at this point, check that your URL is correct and accessible publicly. If you're still having issues, don't hesitate to get in touch)

You're all connected!

Congratulations! You're all set up!