Deploying Tyk on Azure

Azure logo

Pre-requisite: Tyk Self-managed

As part of our diverse deployment options, a Tyk Self-managed license will allow you to deploy on the platform and infrastructure of your choice.

Deploying on Azure requires Tyk Self-managed: the cloud-native API management platform for when you want total control, flexibility, and scalability across REST and GraphQL. Tyk evolves with your infrastructure, giving you complete data sovereignty and security with no lock-in.

If you haven’t gotten started with Tyk Self-managed, you can register for a free trial here.

You can install the entire Tyk API Management platform – Tyk API Dashboard, Designer, Analytics, and Developer Portal – into AWS, into Google Cloud, into your own servers, even on your own laptop. Below we’ll walk you through the steps to get started on Azure.

Performance metrics based on infrastructure size (avg)

 

Instance type
vCPU
Mem
Max Throughput (RPS)
P99 Latency
B1s  1  1   7,670  15.1
B2s
 2  4  13,142  7.9
B2ms
 2  8  11,117  10.2
A8_v2
 8  16  9,920  85.5
F32s_v2
 32  64  41,392  4.9

 


 

Getting started with Tyk on Azure

 

Microsoft Azure is one of the most popular cloud platforms and getting started with Tyk on it has never been easier!

For this demonstration, we will set up a VM instance, deploy Tyk using the tyk-pro-docker image via docker, bootstrap the dashboard, and create our first endpoint. By the end of this tutorial, you’ll have a working version of Tyk that you can use to explore all of Tyk’s features!

Prerequisites:

  • An active Azure account
  • A terminal to run commands in

 


Step 1: Create and launch your VM instance

Log into the Azure dashboard. Once logged in, on the menu to the left, select the Virtual machines menu item

 

Once on the Virtual machines screen click Add -> Virtual machines

 

Now, we can begin to configure our VM. We will keep all the defaults except we will put our Virtual machine name as “tyk-poc”, select a resource group for the VM, select Ubuntu as our Image, and check off the HTTP, HTTPS, and SSH ports under Select inbound ports.

 

NOTE: you may need to create a new resource group if you don’t already have one configured!

After that is set, we then click the Review + create button at the bottom of the screen.

Once at the Review + create screen, we then click the Create button at the bottom of the screen.

 

To log into the VM instance you’ll need a key pair. When you click Create, a modal will pop up to generate a new key pair. You will now click the Download private key and create resources button and save the private key. Don’t lose this file since you’ll need it to log into the VM! Your instance will now launch!

 

Now you’ll see that Azure is launching your instance! Once everything has completed, click the X on the top right of the screen

 

Now, you’ll want to navigate back to the Virtual machines screen. From here we will go to the ellipsis in our VM entry in the table and click “Connect”.

 

From here, we will then need the path to our SSH key saved earlier. This screen will generate some lines of script to help us connect to the instance! Plug in your details, generate the scripts, and log in through your terminal.

 


 

Step 2: Installing Tyk on our new Azure instance!

We are now at the point where we will start to install the required components on the instance.

First we will install Git

sudo apt-get install git -y

Then we will update the repository and install a few more dependencies

sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

Next we we will add the docker GPG key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

And add the Stable Repository where we will grab our docker files for installation

sudo add-apt-repository \
     "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
     $(lsb_release -cs) \
     stable"

Then we once again run an update on the apt package index (This allows us to install docker from the stable repository added in the previous command)

sudo apt-get update

Next, we Install docker

sudo apt-get install docker-ce docker-ce-cli containerd.io

Then install docker-compose

sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

We make docker-compose into an executable

sudo chmod +x /usr/local/bin/docker-compose

And lastly create a symlink for our docker compose executable

sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

After all of the above is set up, clone the Tyk Pro Docker repo from github using:

git clone https://github.com/TykTechnologies/tyk-pro-docker-demo

Then change to the newly created directory:

cd tyk-pro-docker-demo/

At this point we want to bring up the stack. We do that using the docker-compose command like so:

sudo su
docker-compose up -d

 

Once you press ENTER to run the command, the process will start to bring up the stack!

 

Once the process has brought up the stack you should see the following outlining that all components are up and running:

 

Now that we are up and running, let’s navigate to the dashboard to get started with Tyk! For this you’ll want to navigate to: https://<your Azure instance public IP>:3000


 


 

Step 3: Configuring and using your new Tyk instance!

Once we have navigated to the URL in the previous step you will come to the unlicensed dashboard screen. Here you will plug in your Tyk licence key and click “Activate key”.

After this, we should see the Dashboard Setup screen. Here you’ll want to fill out your details and click “BOOTSTRAP”.

After the bootstrap has completed, you then are taken into your new Tyk installation. From here navigate to the API Designer screen by clicking the APIs menu item on the left of the screen.

Once in the API Designer screen, under API Name enter “Test API”

Scrolling down on the screen, we will put our Target URL as “https://httpbin.org

And lastly, at the bottom of the page under Authentication mode, select “Open (Keyless)” as your authentication type. Then click SAVE to create the endpoint.

Now you should see your first endpoint created under the Created APIs list on the next screen.


 


 

Step 4: Test the endpoint!

Lastly, using Postman (or another one of your favourite tools) we will send a GET request to our endpoint. The URL we will hit will be: https://<your Azure instance public IP>:8080/test-api

Your results should look like this:

And there you have it, a new instance of Tyk up and running on Microsoft Azure and Ubuntu. Now you can easily start to discover some of the great features that Tyk has to offer!

Get started with Tyk Self-managed

[hubspot type=form portal=5898904 id=de1ef367-c93a-4edd-8509-b21b62cdfd98]