Tyk Gateway
Overview
This guide covers deploying and configuring Tyk Gateway on Ubuntu 24.04 on Azure from the SecureAnyCloud Azure Marketplace image. Tyk Gateway is a fast, cloud-native, open-source API gateway written in Go. It sits in front of your upstream services and handles authentication, authorization, rate limiting, quotas, request and response transformation, versioning and analytics. Declarative API definitions drive all of it, and you manage them over the control API.
The SecureAnyCloud image ships the free and open-source, MPL-2.0 licensed Tyk Gateway (the OSS Gateway only, with no Dashboard or commercial components). It is installed as the stock package from the official Tyk apt repository and runs as a native systemd service. A local Redis datastore, which the gateway requires for keys, rate limit counters and analytics, is bound to the loopback interface, and nginx fronts the gateway on port 80.
A gateway control plane must never ship with a known secret, so the first boot of each VM generates a unique control API secret and writes it to a 0600 root:root credentials file. Backed by 24/7 SecureAnyCloud support.
Tyk is a trademark of its respective owner. SecureAnyCloud produces this image and is not affiliated with, endorsed by, or sponsored by Tyk Technologies. It ships the free and open-source MPL-2.0 licensed Tyk Gateway (open source edition), unmodified.
What you get:
- Tyk Gateway v5.14.0 (the open-source, MPL-2.0 licensed Gateway edition), installed from the official Tyk apt repository
- A local Redis 7 datastore (the gateway's required store for keys, counters and analytics), bound to
127.0.0.1only, never published to a host port - nginx on port
80reverse proxying the gateway data plane and its public/hellohealth endpoint, and returning403for the control API path so the control plane is never reachable from the internet redis-server.service,tyk-gateway-firstboot.service,tyk-gateway.serviceandnginx.serviceas systemd units, enabled and active on boot- A unique control API secret generated per VM on first boot, never baked into the image, written to
/root/tyk-gateway-credentials.txt - A clean gateway on first boot: no shipped API definitions, no shipped secret, no prior data
- Ubuntu 24.04 LTS base with latest security patches applied at build time
- Azure Linux Agent for cloud integration and SSH key injection
- 24/7 SecureAnyCloud support with a guaranteed 24-hour response SLA
Prerequisites
- An active Azure subscription, an SSH public key, and a VNet and subnet in the target region
- A subscription to the Tyk Gateway listing on Azure Marketplace
- Recommended virtual machine size:
Standard_B2s(2 vCPU, 4 GB RAM) is a sensible starting point. For higher request volumes, useStandard_D2s_v5or larger. - NSG inbound rules: allow
22/tcpfrom your management network and80/tcpfor the API from the networks that call it
Deploy from the Azure Portal
Sign in to the Azure portal, choose Create a resource, search the Marketplace for Tyk Gateway by SecureAnyCloud, and select Create.
On Basics, pick your subscription, resource group, region and size. Under Administrator account, choose SSH public key and paste your key. Under Inbound port rules, allow SSH (22) and HTTP (80). Then select Review + create and Create.
Deploy from the Azure CLI
Run these commands to create the network, accept the Marketplace terms and create the VM:
RG="tyk-prod"; LOCATION="eastus"; VM_NAME="tyk-01" IMAGE_URN="sac1647283583153:tyk-gateway-ubuntu-24-04:default:latest" SSH_KEY="$(cat ~/.ssh/id_rsa.pub)" az group create --name "$RG" --location "$LOCATION" az network vnet create -g "$RG" --name tyk-vnet --address-prefix 10.100.0.0/16 --subnet-name tyk-subnet --subnet-prefix 10.100.1.0/24 az network nsg create -g "$RG" --name tyk-nsg az network nsg rule create -g "$RG" --nsg-name tyk-nsg --name allow-ssh --priority 100 \
--source-address-prefixes "<your-mgmt-cidr>" --destination-port-ranges 22 --access Allow --protocol Tcp az network nsg rule create -g "$RG" --nsg-name tyk-nsg --name allow-http --priority 110 \
--destination-port-ranges 80 --access Allow --protocol Tcp
# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:tyk-gateway-ubuntu-24-04:default:latest
az vm create -g "$RG" --name "$VM_NAME" --image "$IMAGE_URN" \
--size Standard_B2s --storage-sku StandardSSD_LRS \
--admin-username azureuser --ssh-key-values "$SSH_KEY" \
--vnet-name tyk-vnet --subnet tyk-subnet --nsg tyk-nsg --public-ip-sku StandardVerify the services
SSH to the VM as azureuser. Confirm that the gateway, its Redis datastore and nginx are running, and check the listeners:
sudo /opt/tyk-gateway/tyk --version systemctl is-active redis-server tyk-gateway nginx
sudo ss -tlnp | grep -E ':80 |:8080|:6379' | awk '{print $1" "$4}' | sort -uThe version prints 5.14.0, and all three services report active. The listeners show nginx on 0.0.0.0:80, the Tyk gateway on 127.0.0.1:8080 and Redis on 127.0.0.1:6379. The gateway and Redis are bound to the loopback interface, so the only public entry point is nginx on port 80.
Check the health endpoint
The gateway exposes a public, unauthenticated /hello liveness endpoint that reports the gateway version and the health of its Redis datastore. nginx serves it on port 80, so you can use it for a load balancer health probe:
curl -s http://localhost/helloThis returns a JSON document with "status":"pass", the gateway version, and a redis component also reporting "status":"pass". No authentication is required for this endpoint.
Review the per instance secret
A secret generated uniquely on the first boot of each VM protects the gateway control API. First boot writes it, along with the resolved public URL, to a 0600 root:root credentials file. View the file with the commands below. The guide masks the secret, but the real value is on your VM:
sudo stat -c '%A %U:%G %n' /root/tyk-gateway-credentials.txt
sudo grep -E '^TYK_SECRET=|^TYK_URL=' /root/tyk-gateway-credentials.txt \
| sed -r 's/(TYK_SECRET)=.*/\1=<PER-VM-64-HEX-SECRET>/'The file is -rw------- root:root. The TYK_SECRET is a 64 hex character value unique to this VM, created by openssl rand -hex 32 on first boot before the gateway started. There is no default or known secret in the image. The same secret gates every control API call.
Verify the control API security model
The control API lives at /tyk/* on the loopback interface (127.0.0.1:8080) and is gated by the secret. nginx returns 403 for /tyk/ on the public port 80, so the control plane is never reachable from the internet.
Confirm that a missing or wrong secret is rejected with 403, while the per-instance secret authenticates:
SECRET=$(sudo grep '^TYK_SECRET=' /root/tyk-gateway-credentials.txt | cut -d= -f2-)
curl -s -o /dev/null -w 'control API (no secret): %{http_code}\n' http://127.0.0.1:8080/tyk/apis
curl -s -o /dev/null -w 'control API (wrong secret): %{http_code}\n' -H 'x-tyk-authorization: wrong' http://127.0.0.1:8080/tyk/apis
curl -s -o /dev/null -w 'control API (real secret): %{http_code}\n' -H "x-tyk-authorization: $SECRET" http://127.0.0.1:8080/tyk/apis
curl -s -o /dev/null -w 'control API via public :80: %{http_code}\n' http://localhost/tyk/apisThe calls with no secret and a wrong secret are rejected with 403. The call with the real per-instance secret returns 200, and the control API path on the public port 80 returns 403.
This is the whole security model. The health probe is open, the data plane proxies your APIs, and the control plane is on loopback, gated by the per-instance secret, and never exposed publicly.
Create your first proxied API
You manage the gateway by posting API definitions to the control API and hot reloading. Create a simple keyless API that proxies /httpbin/ to the public httpbin.org service, reload the gateway, then send a request through the data plane to see it proxied to the upstream:
SECRET=$(sudo grep '^TYK_SECRET=' /root/tyk-gateway-credentials.txt | cut -d= -f2-)
curl -s -H "x-tyk-authorization: $SECRET" -H 'Content-Type: application/json' -X POST \
-d '{"name":"httpbin","api_id":"httpbin","org_id":"sac","use_keyless":true, "version_data":{"not_versioned":true,"versions":{"Default":{"name":"Default"}}}, "proxy":{"listen_path":"/httpbin/","target_url":"http://httpbin.org","strip_listen_path":true}, "active":true}' \
http://127.0.0.1:8080/tyk/apis
curl -s -H "x-tyk-authorization: $SECRET" http://127.0.0.1:8080/tyk/reload/group >/dev/null sleep 2
curl -s http://localhost/httpbin/get | head -c 200 echoThe POST /tyk/apis returns {"key":"httpbin","status":"ok","action":"added"}, the reload returns 200, and the request to http://localhost/httpbin/get is proxied through the gateway to httpbin.org and returns the upstream JSON response. You have now published an API through Tyk. Replace target_url with your own upstream service and listen_path with the route you want to expose.
Protect an API with a key
Most real APIs are not keyless. Set use_keyless to false with an auth token configuration, then mint a key over the control API. These commands create a protected API on /secure/, then create a key scoped to it:
SECRET=$(sudo grep '^TYK_SECRET=' /root/tyk-gateway-credentials.txt | cut -d= -f2-)
curl -s -H "x-tyk-authorization: $SECRET" -H 'Content-Type: application/json' -X POST \
-d '{"name":"secure-api","api_id":"secure","org_id":"sac","use_keyless":false, "auth":{"auth_header_name":"Authorization"}, "version_data":{"not_versioned":true,"versions":{"Default":{"name":"Default"}}}, "proxy":{"listen_path":"/secure/","target_url":"http://httpbin.org","strip_listen_path":true}, "active":true}' \
http://127.0.0.1:8080/tyk/apis >/dev/null curl -s -H "x-tyk-authorization: $SECRET" http://127.0.0.1:8080/tyk/reload/group >/dev/null sleep 2 curl -s -o /dev/null -w 'secure API (no key): %{http_code}\n' http://localhost/secure/get
KEY=$(curl -s -H "x-tyk-authorization: $SECRET" -H 'Content-Type: application/json' -X POST \
-d '{"allowance":1000,"rate":100,"per":60,"quota_max":-1, "access_rights":{"secure":{"api_id":"secure","api_name":"secure-api","versions":["Default"]}}}' \
http://127.0.0.1:8080/tyk/keys | python3 -c 'import sys,json;print(json.load(sys.stdin)["key_id"])')
curl -s -o /dev/null -w 'secure API (with key): %{http_code}\n' -H "Authorization: $KEY" http://localhost/secure/getThe unauthenticated call to /secure/get is rejected with 401, and the same call with the minted key returns 200. Keys carry their own rate limit (rate/per) and quota, which the gateway enforces using its Redis datastore.
Call the API from your own machine
From anywhere that can reach the VM on port 80, call your published APIs at the VM public IP. The /hello health check and any keyless API need no credentials:
curl http://<vm-ip>/hello
curl http://<vm-ip>/httpbin/getTo manage the gateway (add or change API definitions) from outside the VM, SSH in and use the control API on 127.0.0.1:8080 with the per-instance secret, or front the gateway with your own management tooling. The control API is intentionally not exposed on the public port.
Use your own domain and HTTPS (production)
The image serves the API over plain HTTP on port 80, which suits a load balancer or private network. For production, terminate TLS in front of Tyk so credentials and payloads travel encrypted:
- Front the VM with Azure Application Gateway, a load balancer with a managed certificate, or a CDN, and forward to nginx on port
80. - Or install your own certificate: add a TLS
serverblock that references your certificate and key to/etc/nginx/sites-available/tyk-gateway, open443/tcpon the NSG, then runsudo systemctl reload nginx. - Point a DNS name you control at the VM public IP and use that name (and
https://) for your API consumers.
Server components
Component Version / Detail
API gateway Tyk Gateway v5.14.0 (open source, MPL-2.0, Gateway edition)
API front nginx on :80 reverse proxying to 127.0.0.1:8080
Datastore local Redis 7 (loopback 127.0.0.1:6379, no host port)
Control API /tyk/* on loopback 127.0.0.1:8080, gated by the per instance secret; 403 on public :80
Health endpoint /hello (public, no auth) reporting gateway + Redis health
Control API secret per instance, generated first boot into /root/tyk-gateway-credentials.txt
Mode OSS file based (use_db_app_configs false), no Dashboard
Support
Every SecureAnyCloud image is backed by 24/7 support with a guaranteed 24-hour response SLA. For help with this image, contact sales@secureanycloud.com.
Tyk is a trademark of its respective owner. This image ships the free and open-source MPL-2.0 licensed Tyk Gateway (open source edition), unmodified, and is not affiliated with or endorsed by Tyk Technologies.
Deploy on Azure
Launch Tyk Gateway on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.
View this image
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com
Overview
This guide covers deploying and configuring Tyk Gateway on AWS from the SecureAnyCloud AWS Marketplace image. Tyk Gateway is a fast, cloud-native, open-source API gateway written in Go. It sits in front of your services and handles authentication, authorization, rate limiting, quotas, request and response transformation, API versioning and analytics, all driven by declarative API definitions.
This image ships the open-source Gateway on its own, in file-based mode with a local Redis datastore. You get a complete standalone gateway with no external dependencies, no Dashboard and no commercial components.
The image installs the Gateway from the official, unmodified open-source Tyk package and runs it under systemd as tyk-gateway.service. The gateway binds to loopback only and serves the data plane, the unauthenticated /hello health endpoint and the secret-gated control API (/tyk/*) on one local port (127.0.0.1:8080). A local Redis instance, also bound to loopback, is the required datastore for keys, analytics and rate limiting. An nginx front end publishes the data plane and the public health endpoint on port 80, and refuses the control API path so the control plane is never reachable from the internet.
Secure by default, with no known secret. The control API secret lets you create and rotate API definitions and keys, so a shared or baked-in secret would let anyone drive your gateway. This image avoids that. On the first boot of every instance, a one-shot service generates a unique 64-character control API secret for this instance alone and rewrites the gateway configuration with strict permissions. It then resolves this instance's public URL, records the secret and URL in a root-only file, and only then starts the gateway.
The control API and Redis are bound to loopback, and the public port 80 returns a forbidden response for the control API path.
What you get:
- Tyk Gateway (version 5.14.0) installed from the official open-source package, run under systemd as
tyk-gateway.service - A local Redis datastore (
redis-server.service) bound to127.0.0.1:6379, the required store for keys, quotas, rate limit counters and analytics - An nginx front end publishing the data plane and the public
/hellohealth endpoint on port 80, and returning403for the control API path/tyk/ - The control API (
/tyk/*) bound to loopback127.0.0.1:8080, gated by a per-instance secret through thex-tyk-authorizationheader - A unique per-instance control API secret generated on first boot and written with the instance public URL to
/root/tyk-gateway-credentials.txt(root only)
Prerequisites
- An AWS account subscribed to the Tyk Gateway listing on AWS Marketplace
- An EC2 key pair for SSH access, and a VPC and subnet in your target region
- A security group that allows TCP 22 (administration) and TCP 80 (API traffic to the data plane and the health endpoint)
- Recommended instance type:
m5.large(2 vCPU, 8 GB RAM) is a comfortable starting point for a production gateway. Tyk Gateway is a lightweight Go daemon. Scale the instance type up for very high request throughput.
Connecting to your instance
Connect over SSH as the default login user for the operating system variant you launched.
OS variant SSH login user Example
Ubuntu 24.04 ubuntu ssh -i your-key.pem ubuntu@<public-ip>
Replace <public-ip> with your instance's public IPv4 address (or DNS name) from the EC2 console. Replace your-key.pem with the private key for the key pair you launched with.
First boot and your per instance secret
On first boot the image generates a unique control API secret for this instance and records it, together with the instance public URL, in a root-only credentials file. Read the file with:
sudo cat /root/tyk-gateway-credentials.txtThe file contains:
TYK_SECRET: the per-instance control API secret. Send it in thex-tyk-authorizationheader on every control API call. Keep this file secret. It is0600 root:root.TYK_URL: this instance's public base URL (for examplehttp://<public-ip>/), where the data plane and the/hellohealth endpoint are reachable.
There is no default or shared secret. Two instances launched from this image get different secrets.
Checking gateway health
The gateway exposes an unauthenticated /hello liveness endpoint that also reports the Redis datastore health. It is reachable on the public port 80 and on the loopback data plane. Request it with:
curl http://<public-ip>/hello{"status":"pass","version":"5.14.0","description":"Tyk GW","details":{"redis":{"status":"pass","componentType":"datastore","time":"2026-07-24T04:23:31Z"}}}A status of pass confirms the gateway is serving and Redis is connected.
The control API is gated and loopback only
You use the control API (/tyk/*) to create, list and remove API definitions and keys. It is bound to loopback 127.0.0.1:8080 and requires the per-instance secret. A request with no secret, or one sent through the public port 80, is rejected:
# read the per instance secret into a shell variable (never echo it)
SECRET=$(sudo awk -F= '/^TYK_SECRET=/{print $2}' /root/tyk-gateway-credentials.txt)
# no secret -> rejected curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8080/tyk/apis
# correct secret -> 200 curl -s -o /dev/null -w '%{http_code}\n' -H "x-tyk-authorization: $SECRET" http://127.0.0.1:8080/tyk/apis
# via the public :80 -> refused by nginx curl -s -o /dev/null -w '%{http_code}\n' http://<public-ip>/tyk/apis403 200 403Only a request on the loopback interface that carries the correct per-instance secret reaches the control API. The public port 80 serves only the data plane and the health endpoint.
Defining an API and proxying a request through the gateway
Create a declarative API definition through the control API, then hot reload the gateway. This example proxies requests under /httpbin/ to a public upstream:
SECRET=$(sudo awk -F= '/^TYK_SECRET=/{print $2}' /root/tyk-gateway-credentials.txt)
curl -s -H "x-tyk-authorization: $SECRET" -H 'Content-Type: application/json' -X POST -d '{ "name":"httpbin","api_id":"httpbin","org_id":"sac","use_keyless":true, "version_data":{"not_versioned":true,"versions":{"Default":{"name":"Default"}}}, "proxy":{"listen_path":"/httpbin/","target_url":"http://httpbin.org","strip_listen_path":true}, "active":true}' http://127.0.0.1:8080/tyk/apis
curl -s -H "x-tyk-authorization: $SECRET" http://127.0.0.1:8080/tyk/reload/group{"key":"httpbin","status":"ok","action":"added"} {"status":"ok","message":""}Now send a request through the public data plane on port 80. The gateway proxies it to the upstream and returns the response:
curl http://<public-ip>/httpbin/get{ "args": {}, "headers": { "Accept": "*/*", "Accept-Encoding": "gzip", "Host": "httpbin.org", "User-Agent": "curl/8.5.0" }, "origin": "127.0.0.1, 127.0.0.1, 34.203.215.132", "url": "http://httpbin.org/get" }The request entered the gateway on port 80, matched the /httpbin/ listen path and was forwarded to the upstream, which shows traffic proxying through the gateway. From here, you can add authentication, rate limiting and quotas to the API definition, or point target_url at your own service.
Security model and hardening
- No known credential. The control API secret is generated uniquely per instance on first boot. There is no default or shared secret baked into the image.
- Loopback control plane. The gateway (data plane,
/helloand the control API) binds to127.0.0.1:8080, and Redis binds to127.0.0.1:6379. Neither is reachable directly from the network. - nginx boundary. nginx on port 80 publishes only the data plane and the
/hellohealth endpoint, and returns403for/tyk/, so the control plane is never reachable from the internet. - Minimal exposure. The recommended security group opens only TCP 22 (SSH, key only) and TCP 80 (API traffic). Restrict port 80 to the clients that call your APIs, and administer over SSH with your EC2 key pair.
- Terminate TLS at the edge. For production, front the gateway with TLS. Terminate HTTPS in nginx on this instance, or place an Application Load Balancer or CloudFront in front of port 80.
Managing the services
The gateway, its datastore and the front end run under systemd. Manage them with:
systemctl status tyk-gateway
systemctl status redis-server
systemctl status nginx
# after editing /opt/tyk-gateway/tyk.conf
sudo systemctl restart tyk-gatewayAPI definitions are stored as JSON files under /opt/tyk-gateway/apps/. You can manage them through the control API (recommended) or by editing files and reloading the gateway with a call to /tyk/reload/group.
Support
SecureAnyCloud provides 24/7 technical support for this Tyk Gateway image by email (sales@secureanycloud.com) and live chat, with a one-hour average response time for critical issues. Support covers authoring API definitions, authentication and rate limit policies, nginx and TLS front end configuration, connecting the gateway to your services, security group rules, health checks, and Tyk Gateway version upgrades.
Tyk Gateway is open-source software distributed under the MPL-2.0 license. SecureAnyCloud is not affiliated with or endorsed by Tyk Technologies. The Tyk name is used only to identify the open-source software shipped in this image.
Deploy on AWS
Launch Tyk Gateway with 24/7 support from SecureAnyCloud.
View on Marketplace
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com