<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Deepanshu Pandey</title>
    <description>The latest articles on DEV Community by Deepanshu Pandey (@deepanshup04).</description>
    <link>https://dev.to/deepanshup04</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1404950%2Fd5728a67-8686-40aa-8e4a-e5ace47349ef.jpg</url>
      <title>DEV Community: Deepanshu Pandey</title>
      <link>https://dev.to/deepanshup04</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/deepanshup04"/>
    <language>en</language>
    <item>
      <title>Understanding Regex in Kong Gateway: Then vs Now</title>
      <dc:creator>Deepanshu Pandey</dc:creator>
      <pubDate>Sat, 19 Jul 2025 14:25:30 +0000</pubDate>
      <link>https://dev.to/deepanshup04/understanding-regex-in-kong-gateway-then-vs-now-i8o</link>
      <guid>https://dev.to/deepanshup04/understanding-regex-in-kong-gateway-then-vs-now-i8o</guid>
      <description>&lt;p&gt;Whether you're building scalable APIs or managing complex traffic flows, &lt;strong&gt;Kong Gateway&lt;/strong&gt; offers powerful routing capabilities — and at the heart of that power lies one timeless tool: &lt;strong&gt;regular expressions (regex)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Regex gives you fine-grained control over how requests are matched, routed, or filtered. But like everything else, Kong's support for regex has evolved significantly — especially with the introduction of &lt;strong&gt;expressions&lt;/strong&gt; in newer versions.&lt;/p&gt;

&lt;p&gt;In this post, let’s dive deep into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How regex worked in earlier versions of Kong&lt;/li&gt;
&lt;li&gt;What’s changed in Kong 3.x and beyond&lt;/li&gt;
&lt;li&gt;Practical use cases and syntax examples&lt;/li&gt;
&lt;li&gt;When to use plain regex and when to switch to expressions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🔍 &lt;strong&gt;What is Regex in Kong?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Regular expressions are string patterns that allow matching flexible and complex inputs — such as paths, headers, hostnames, and even query parameters.&lt;/p&gt;

&lt;p&gt;In Kong, regex is typically used to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Match incoming request paths (e.g., /users/123)&lt;/li&gt;
&lt;li&gt;Match hostnames (e.g., *.example.com)&lt;/li&gt;
&lt;li&gt;Filter headers like X-User-Type: admin&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can write regex patterns in route fields such as &lt;strong&gt;paths&lt;/strong&gt;, &lt;strong&gt;hosts&lt;/strong&gt;, or &lt;strong&gt;headers&lt;/strong&gt;, and Kong will evaluate them to decide whether a request should be routed.&lt;/p&gt;

&lt;p&gt;📜 &lt;strong&gt;Regex in Older Kong Versions (Pre-3.x)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In earlier Kong versions, regex was supported — but only within a few specific fields:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use regex in paths, like /api/v1/users/\d+&lt;/li&gt;
&lt;li&gt;Use regex in headers, with special syntax like ~ for case-sensitive, and ~* for case-insensitive matching&lt;/li&gt;
&lt;li&gt;Combine multiple route conditions — but they were evaluated separately and limited in complexity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🧪 &lt;strong&gt;Example 1: Regex in Path&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;"paths": ["/users/\d+"]&lt;/p&gt;

&lt;p&gt;🧪 &lt;strong&gt;Example 2: Regex in Header&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;"headers": {&lt;br&gt;
  "x-role": ["~^admin$"]&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;⚠️ &lt;strong&gt;Limitations in the Past&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;While powerful, this older approach came with limitations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;❌ No way to write complex combined conditions (e.g., header + path regex)&lt;/li&gt;
&lt;li&gt;❌ Couldn’t easily use request method (GET, POST) in regex logic&lt;/li&gt;
&lt;li&gt;❌ Static matching — no dynamic plugin control or conditional logic&lt;/li&gt;
&lt;li&gt;❌ Managing multiple routes with slightly different patterns became messy&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;⚡ &lt;strong&gt;Regex in Modern Kong (v3.0 – v3.7+)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With the evolution of Kong Gateway (starting around v3.0), expressions were introduced — bringing more power, flexibility, and logical operations to routing and plugin control.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Good News:&lt;/strong&gt; Regex still works!&lt;/p&gt;

&lt;p&gt;Regex is still fully supported in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;paths&lt;/li&gt;
&lt;li&gt;hosts&lt;/li&gt;
&lt;li&gt;headers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But now, you also get &lt;strong&gt;regex support inside expressions&lt;/strong&gt;, unlocking much more power.&lt;/p&gt;

&lt;p&gt;🧠 &lt;strong&gt;What Are Expressions?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Expressions in Kong are Lua-style conditions that can evaluate fields like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;request.path&lt;/li&gt;
&lt;li&gt;request.headers&lt;/li&gt;
&lt;li&gt;request.method&lt;/li&gt;
&lt;li&gt;request.query&lt;/li&gt;
&lt;li&gt;request.jwt.claims&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And yes — you can use regex functions like &lt;strong&gt;string.match(&lt;/strong&gt;) and &lt;strong&gt;ngx.re.match()&lt;/strong&gt; inside them.&lt;/p&gt;

&lt;p&gt;🔁 &lt;strong&gt;Regex vs Expressions in Kong (Tabular View)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here’s how the two approaches compare:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8oujher8gv2j1uyjot3b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8oujher8gv2j1uyjot3b.png" alt=" " width="738" height="287"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;💡 &lt;strong&gt;Real-World Use Cases&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Path Matching with Regex&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;"paths": ["/orders/\d{4,6}"]&lt;br&gt;
&lt;em&gt;Matches /orders/1234 or /orders/654321.&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Header Matching with Regex&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;"headers": {&lt;br&gt;
  "x-region": ["~^apac-.*$"]&lt;br&gt;
}&lt;br&gt;
&lt;em&gt;Matches x-region: apac-east or apac-west.&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Expression with Regex (New Style)&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;expression = "ngx.re.match(request.path, '^/reports/[0-9]{4}/[a-z]+$')"&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Case-Insensitive Header Match using Expressions&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;expression = "string.lower(request.headers['x-department']) == 'finance'"&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Tips for Writing Safe Regex in Kong&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Escape special characters properly in JSON/YAML (use \)&lt;/li&gt;
&lt;li&gt;Use ~* for case-insensitive matches&lt;/li&gt;
&lt;li&gt;Test with &lt;strong&gt;&lt;a href="https://regex101.com/" rel="noopener noreferrer"&gt;https://regex101.com/&lt;/a&gt;&lt;/strong&gt; before deploying&lt;/li&gt;
&lt;li&gt;Prefer expressions for combined, readable logic&lt;/li&gt;
&lt;li&gt;Be cautious — overly complex regex can slow down high-throughput routes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;📦 &lt;strong&gt;Summary&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Regex is still a cornerstone of Kong Gateway’s routing power — but the introduction of expressions has taken it to the next level.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🏷️ Older versions = regex only in a few places, limited flexibility&lt;/li&gt;
&lt;li&gt;🧠 Newer versions (3.0+) = regex plus full-blown logic with expressions&lt;/li&gt;
&lt;li&gt;🔄 Use regex where it makes sense (simple patterns)&lt;/li&gt;
&lt;li&gt;⚙️ Use expressions for more advanced routing or plugin logic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🧩 &lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Regex hasn’t gone anywhere — but it now has a smarter companion in &lt;strong&gt;Kong expressions&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;By combining the two, you can create more &lt;strong&gt;dynamic&lt;/strong&gt;, &lt;strong&gt;maintainable&lt;/strong&gt;, and &lt;strong&gt;secure&lt;/strong&gt; Kong configurations.&lt;/p&gt;

&lt;p&gt;So… are you still using regex the old way?&lt;/p&gt;

&lt;p&gt;Try expressions with regex today — and &lt;strong&gt;level up your API Gateway game!&lt;/strong&gt; 💥&lt;/p&gt;

</description>
      <category>kong</category>
      <category>apigateway</category>
      <category>kongapi</category>
      <category>regex</category>
    </item>
    <item>
      <title>The Ultimate Guide to Installing Kong Gateway on Docker, Kubernetes, and Linux</title>
      <dc:creator>Deepanshu Pandey</dc:creator>
      <pubDate>Sat, 26 Apr 2025 13:02:50 +0000</pubDate>
      <link>https://dev.to/deepanshup04/the-ultimate-guide-to-installing-kong-gateway-on-docker-kubernetes-and-linux-4kbk</link>
      <guid>https://dev.to/deepanshup04/the-ultimate-guide-to-installing-kong-gateway-on-docker-kubernetes-and-linux-4kbk</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is Kong Gateway ?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Kong Gateway is a robust, scalable API Gateway and Microservices Management Layer designed to simplify the process of managing APIs. It provides features such as load balancing, traffic control, monitoring, and security—all in one place. With its flexible deployment options, Kong can be installed on a range of platforms, including Docker, Kubernetes, and various Linux distributions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Use Kong Gateway ?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Kong is favored for its:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scalability:&lt;/strong&gt; With support for Kubernetes and Docker, Kong can handle high traffic loads.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;High Availability:&lt;/strong&gt; Its clustering feature ensures your API Gateway remains operational even during heavy traffic or node failures.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Security:&lt;/strong&gt; Kong provides features like rate-limiting, authentication, and access control to keep your APIs secure.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Performance:&lt;/strong&gt; Designed for microservices architecture, Kong is built for speed, allowing efficient API traffic routing.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Kong Gateway Installation on Docker&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before you begin the installation, ensure that you have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Docker installed on your system.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A basic understanding of Docker and containers.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step-by-Step Installation Guide&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To install Kong Gateway on Docker, follow these steps:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Pull the Kong Image&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First, you need to pull the official Kong Gateway image from Docker Hub:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker pull kong/kong-gateway:latest&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Run Kong Container&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now, run the Kong Gateway container. The following command will run Kong in detached mode, bind it to a host port, and set an environment variable for the database:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker run -d --name kong \&lt;br&gt;
   -e "KONG_DATABASE=off" \&lt;br&gt;
   -e "KONG_DECLARATIVE_CONFIG=/kong/kong.yml" \&lt;br&gt;
   -e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \&lt;br&gt;
   -e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" \&lt;br&gt;
   -e "KONG_ADMIN_ERROR_LOG=/dev/stderr" \&lt;br&gt;
   -e "KONG_PORT_MAPS=8000:8000" \&lt;br&gt;
   -e "KONG_PORT=8000" \&lt;br&gt;
   -v /path/to/your/kong.yml:/kong/kong.yml \&lt;br&gt;
   -p 8000:8000 \&lt;br&gt;
   kong/kong-gateway:latest&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Check Kong Gateway&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After the container is running, you can check Kong’s status by sending a request to its Admin API:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;curl -i http://localhost:8001&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Verifying the Installation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To ensure that Kong Gateway is running correctly, you can check the logs:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker logs kong&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If everything is working, you should see Kong logs indicating it’s up and running.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Kong Gateway Installation on Kubernetes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before installing Kong on Kubernetes, ensure the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A Kubernetes cluster (using Minikube, GKE, or any other provider).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;kubectl&lt;/strong&gt; command-line tool configured to communicate with your Kubernetes cluster.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step-by-Step Installation Guide&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Kong can be installed in Kubernetes using &lt;strong&gt;Helm&lt;/strong&gt;, a package manager for Kubernetes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Install Helm&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you don’t have Helm installed, use the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;curl https://get.helm.sh/helm-v3.7.1-linux-amd64.tar.gz -o helm-v3.7.1-linux-amd64.tar.gz&lt;br&gt;
tar -xvzf helm-v3.7.1-linux-amd64.tar.gz&lt;br&gt;
sudo mv linux-amd64/helm /usr/local/bin/helm&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Add Kong’s Helm Repository&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Add the official Kong Helm repository:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;helm repo add kong https://charts.konghq.com&lt;br&gt;
helm repo update&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Install Kong Gateway&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use Helm to install Kong into your Kubernetes cluster:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;helm install kong kong/kong-gateway --set ingressController.enabled=true&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Verify Installation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After installation, check if Kong pods are running with:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;kubectl get pods -n kong&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This command will list the pods, and you should see &lt;strong&gt;kong-ingress-controller&lt;/strong&gt; running.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Verifying the Installation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Test the Kong Gateway by making a request to the Kong proxy:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;_curl -i http://&amp;lt;KONG_PROXY_IP&amp;gt;:8000_&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you see a response, then Kong is successfully deployed on Kubernetes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Kong Gateway Installation on Linux&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now, let’s look at how to install Kong Gateway on different Linux distri__butions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installing on Debian&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Add Kong Repository&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Add the Kong APT repository to your system:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;curl -fsSL https://konghq.com/install-deb | sudo tee /etc/apt/sources.list.d/kong.list&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Install Kong&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Install Kong with the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo apt-get update&lt;br&gt;
sudo apt-get install kong&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Verify Installation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Check Kong’s version:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;kong version&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installing on Ubuntu&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The installation process for Ubuntu is the same as Debian, since Ubuntu is based on Debian.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Add Kong Repository&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Add the Kong APT repository:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;curl -fsSL https://konghq.com/install-deb | sudo tee /etc/apt/sources.list.d/kong.list&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Install Kong&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Install Kong with:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo apt-get update&lt;br&gt;
sudo apt-get install kong&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Verify Installation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Confirm the installation by checking Kong’s version:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;kong version&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installing on RedHat&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Add Kong Repository&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Add the Kong repository for RedHat:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo curl -fsSL https://konghq.com/install-rpm | sudo tee /etc/yum.repos.d/kong.repo&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Install Kong&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Install Kong using &lt;strong&gt;YUM&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo yum install kong&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Verify Installation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Verify that Kong is installed by checking its version:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;kong version&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installing on Amazon Linux 2&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Add Kong Repository&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Add the Kong repository for Amazon Linux 2:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo curl -fsSL https://konghq.com/install-rpm | sudo tee /etc/yum.repos.d/kong.repo&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Install Kong&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Install Kong using &lt;strong&gt;YUM&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo yum install kong&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Verify Installation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Confirm Kong is installed:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;kong version&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Verifying the Installation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For any Linux distribution, after installation, verify the Kong service is running by checking its status:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo systemctl status kong&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Kong Gateway provides powerful API management capabilities, whether you're deploying on &lt;strong&gt;Docker&lt;/strong&gt;, &lt;strong&gt;Kubernetes&lt;/strong&gt;, or &lt;strong&gt;Linux&lt;/strong&gt;. With just a few simple steps, you can install Kong on any of these platforms and start using its features for managing your microservices and APIs. &lt;/p&gt;

&lt;p&gt;This guide covers the installation for each of the popular platforms, and you can always refer to the official documentation for further customization and configuration.&lt;/p&gt;

&lt;p&gt;For more detailed information and advanced configurations, visit the official &lt;a href="https://docs.konghq.com/gateway/latest/install/" rel="noopener noreferrer"&gt;Kong Gateway Installation Documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Ready to get started with Kong Gateway? Happy installing!&lt;/p&gt;

</description>
      <category>kong</category>
      <category>docker</category>
      <category>kubernetes</category>
      <category>linux</category>
    </item>
    <item>
      <title>Unlocking Efficiency: The Power of Kong AI Gateway</title>
      <dc:creator>Deepanshu Pandey</dc:creator>
      <pubDate>Sat, 26 Apr 2025 09:16:03 +0000</pubDate>
      <link>https://dev.to/deepanshup04/unlocking-efficiency-the-power-of-kong-ai-gateway-4f9m</link>
      <guid>https://dev.to/deepanshup04/unlocking-efficiency-the-power-of-kong-ai-gateway-4f9m</guid>
      <description>&lt;p&gt;In today’s rapidly evolving digital landscape, organizations increasingly rely on APIs to drive innovation, enhance connectivity, and streamline operations. However, as the complexity of managing these APIs grows, the need for advanced solutions becomes paramount. &lt;/p&gt;

&lt;p&gt;Enter Kong’s AI Gateway—a revolutionary product designed to transform the way we think about API management by leveraging artificial intelligence to provide intelligent insights, enhanced security, and optimized performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the AI Gateway?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The rapid emergence of various AI LLM providers, including open-source and self-hosted models, has led to a fragmented technology landscape with inconsistent standards and controls. &lt;/p&gt;

&lt;p&gt;This fragmentation complicates how developers and organizations utilize &lt;br&gt;
and govern AI services. Kong Gateway’s extensive API management &lt;br&gt;
capabilities and plugin extensibility make it an ideal solution for providing AI-specific management and governance services. &lt;/p&gt;

&lt;p&gt;Since AI providers often do not adhere to a standardized API specification, the AI Gateway offers a normalized API layer that enables clients to access multiple AI services from a single codebase. It&lt;br&gt;
enhances capabilities such as credential management, AI usage observability, governance, an prompt engineering for fine-tuning models. Developers can utilize no-code AI plugins to enrich their existing API traffic, thereby enhancing application functionality with ease.&lt;/p&gt;

&lt;p&gt;You can activate the AI Gateway features through a range of modern, specialized plugins, following the same approach as with other Kong Gateway plugins. When integrated with existing Kong Gateway plugins, users can quickly build a robust AI management platform without the need for custom coding or introducing new, unfamiliar tools.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhkia7t8rne1fxt3x8kiv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhkia7t8rne1fxt3x8kiv.png" alt="Image description" width="768" height="260"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Features and Benefits&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Intelligent Traffic Management:&lt;/strong&gt; The AI Gateway’s intelligent traffic management capabilities analyze real-time data to optimize request routing. By employing machine learning algorithms, the gateway adapts to changing conditions, ensuring that requests are processed through the most efficient paths. This results in lower latency, improved performance, and a seamless user experience. Additionally, the gateway can automatically balance loads across services, preventing any single service from becoming a bottleneck.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Enhanced Security:&lt;/strong&gt; Security is a top concern for any organization operating in the digital realm. The AI Gateway takes a proactive stance by using AI to identify and mitigate threats before they impact your systems. It can detect anomalies in traffic patterns, flag suspicious&lt;br&gt;
activities, and automatically apply security protocols to safeguard APIs. This real-time threat detection ensures that your APIs are resilient against attacks, providing peace of mind to organizations and their users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Seamless Integration:&lt;/strong&gt; The AI Gateway is designed to fit seamlessly within existing infrastructures. It supports a wide array of integrations, allowing organizations to connect with their current tools and platforms without any disruption. This flexibility means teams&lt;br&gt;
can leverage the AI Gateway's capabilities without overhauling their entire tech stack, making it easier to adopt and implement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Automated Insights and Reporting:&lt;/strong&gt; With the AI Gateway, organizations benefit from automated insights that simplify the understanding of API usage and performance metrics. These insights are generated through AI analysis, allowing teams to access critical&lt;br&gt;
information at a glance. This capability enables informed decision making, optimizes resource allocation, and drives continuous improvement, ultimately enhancing overall performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Collaborative Features:&lt;/strong&gt; Modern workplaces thrive on collaboration, and the AI Gateway facilitates teamwork across various departments. It provides features that enhance communication between developers, security teams, and operations staff, fostering a unified approach to API management. By breaking down silos, the AI Gateway promotes efficiency&lt;br&gt;
and accelerates the development lifecycle.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Plugin Ecosystem:&lt;/strong&gt; One of the standout aspects of the AI Gateway is its robust plugin ecosystem. Kong offers a variety of plugins that extend the functionality of the gateway, allowing organizations to customize their API management experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Most used LLMs:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqlvg6p75sj8ppywpde6q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqlvg6p75sj8ppywpde6q.png" alt="Image description" width="800" height="509"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The infographic presents a breakdown of the most popular Large Language Models (LLMs) currently in use. Here's a summary of the key takeaways:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dominant Players:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. ChatGPT:&lt;/strong&gt; With a significant share of 27%, ChatGPT remains the most widely used LLM. Its user-friendly interface and impressive language capabilities have contributed to its popularity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Azure AI:&lt;/strong&gt; Closely following ChatGPT, Azure AI holds a 18% share. It's backed by Microsoft's extensive resources and offers a range of AI services, including LLM capabilities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Google Gemini:&lt;/strong&gt; Google's latest LLM, Gemini, has quickly gained traction with a 17% share. It's known for its advanced capabilities in various language tasks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Other Notable LLMs:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Meta Llama:&lt;/strong&gt; With an 8% share, Meta Llama is a powerful LLM developed by Meta (formerly Facebook).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Amazon Bedrock:&lt;/strong&gt; Amazon's Bedrock offers access to a variety of foundation models, including LLMs. It holds a 7% share.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Claude:&lt;/strong&gt; Anthropic's Claude is a versatile LLM with a 7% share, known for its ability to generate creative and informative text.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Cohere:&lt;/strong&gt; Cohere provides a suite of AI tools, including LLMs, with a 5% share.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Mistral:&lt;/strong&gt; Mistral is a relatively new LLM with a 4% share, gaining attention for its promising capabilities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Insights:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. ChatGPT's Dominance:&lt;/strong&gt; ChatGPT's strong market position highlights its ability to meet a wide range of user needs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Cloud Providers' Influence:&lt;/strong&gt; Major cloud providers like Microsoft and Google are making significant strides in the LLM space, providing powerful AI capabilities to their users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Emerging Players:&lt;/strong&gt; LLMs like Meta Llama and Mistral demonstrate the growing diversity and innovation in the LLM landscape. &lt;/p&gt;

&lt;p&gt;This infographic offers a snapshot of the current LLM landscape, highlighting the leading models and their relative popularity. As the field of AI continues to evolve, we can expect further developments&lt;br&gt;
and shifts in the usage of LLMs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Kong AI Plugins&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. AI Proxy:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Purpose: This plugin simplifies making your first AI request.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How it works: It provides a user-friendly interface to connect to various AI models or services, allowing you to experiment and build AI-powered applications without deep technical knowledge.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. AI Gateway:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Purpose: This is the core plugin that enables you to build new AI applications faster and power existing API traffic with AI capabilities.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How it works: It integrates multiple LLMs (Large Language Models) and provides security, metrics, and other essential functionalities for AI-powered applications. It also supports declarative configuration, making it easier to manage AI integrations.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Request Transformer:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Purpose: This plugin allows you to transform API requests with no-code AI integrations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How it works: It uses AI models to modify, enhance, or augment incoming requests, making them more suitable for processing by the backend services.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Response Transformer:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Purpose: This plugin transforms, enriches, and augments API responses using no-code AI integrations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How it works: It uses AI models to process API responses and generate more informative or personalized outputs.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. AI Prompt Guard:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Purpose: This plugin secures your AI prompts by implementing advanced prompt security.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How it works: It analyses prompts and filters out malicious or inappropriate content, ensuring that the AI models are used responsibly.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;6. AI Prompt Template:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Purpose: This plugin helps you create better prompts by building AI templates that are compatible with the OpenAI interface.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How it works: It provides a structured way to create effective prompts for AI models, improving the quality of AI-generated outputs.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;7. AI Prompt Decorator:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Purpose: This plugin helps you build better AI contexts by centrally managing the contexts and behaviors of every AI prompt.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How it works: It allows you to define and manage the context of an AI prompt, ensuring that the AI model understands the desired outcome and generates more relevant responses.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;In essence, the Kong AI Gateway plugins provide a comprehensive suite of tools to build and manage AI-powered applications. They simplify the integration of AI models, enhance security, and improve the overall performance of AI-driven systems.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use cases of Kong AI Gateway&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu0pqfalkksan9lyqip7q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu0pqfalkksan9lyqip7q.png" alt="Image description" width="781" height="316"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Multi-AI Adoption&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Core Concept:
This approach emphasizes utilizing the right AI model for the right task. It's about tailoring AI solutions to specific needs, rather than relying on a one-size-fits-all model.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Benefits:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Flexibility: Different AI models excel in different tasks (e.g., image recognition, natural language processing, etc.). Choosing the best-suited model allows for optimal results.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cost-Control: Not every task requires the most advanced AI model. By selecting the right model, you can optimize costs without compromising performance.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. AI Data Governance&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Core Concept: This focuses on ensuring responsible and ethical use of AI by controlling the flow of information to AI models.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Importance:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Data Privacy: Protecting sensitive data from unauthorized access or misuse is paramount.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Model Bias: Preventing AI models from learning and perpetuating biases in the data they are trained on.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. AI Usage Governance&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Core Concept:
This involves monitoring and regulating the use of AI to mitigate risks and ensure compliance with policies.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why it Matters:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Unregulated AI: Uncontrolled AI usage can lead to unintended consequences, such as job displacement or algorithmic bias.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Policy Enforcement: AI Usage Governance ensures that AI is used in accordance with ethical guidelines and legal regulations.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Kong’s AI Gateway represents a significant advancement in API management, merging cutting-edge AI technology with robust functionality. As businesses navigate the complexities of the digital landscape, solutions like the AI Gateway offer the tools needed to thrive.&lt;/p&gt;

&lt;p&gt;Whether you aim to improve traffic management, enhance security, or gain deeper insights into your API performance, the AI Gateway is designed to meet these challenges head-on. With its intelligent features, seamless integration, and customizable plugins, it’s time to explore how Kong’s AI Gateway can transform your API strategy and drive your organization forward.&lt;/p&gt;

&lt;p&gt;For more information about the AI Gateway and to explore the available plugins, visit the official Kong documentation and hub. Embrace the future of API management today!&lt;/p&gt;

</description>
      <category>kong</category>
      <category>llm</category>
      <category>ai</category>
    </item>
    <item>
      <title>What is deck and How can it be used in Kong? A Hands-on Guide</title>
      <dc:creator>Deepanshu Pandey</dc:creator>
      <pubDate>Thu, 25 Apr 2024 08:29:21 +0000</pubDate>
      <link>https://dev.to/deepanshup04/what-is-deck-and-how-can-it-be-used-in-kong-a-hands-on-guide-7kh</link>
      <guid>https://dev.to/deepanshup04/what-is-deck-and-how-can-it-be-used-in-kong-a-hands-on-guide-7kh</guid>
      <description>&lt;p&gt;Deck&lt;/p&gt;

&lt;p&gt;Deck is a tool that helps you manage your Kong configuration in a declarative way. This configuration can be conveniently stored in the code repository. Deck is responsible for synchronizing the Kong configuration in the code repository with the running Kong instance. It was created mainly to make it easy to automate Kong configuration management in CI/CD processes.&lt;/p&gt;

&lt;p&gt;In the world of Kong, Deck is a tool that helps manage configurations using declarative files. These files describe how Kong's API Gateway should be set up, including things like services, routes, and plugins.&lt;/p&gt;

&lt;p&gt;Overall, Deck simplifies managing Kong clusters by providing a clear and manageable way to define and apply configurations.&lt;/p&gt;

&lt;p&gt;Why Use Deck?&lt;/p&gt;

&lt;p&gt;There are several benefits to using Deck for managing configurations in Kong:&lt;/p&gt;

&lt;p&gt;• Version control: Deck uses declarative files, which can be version controlled using tools like Git. This allows you to track changes to your Kong configuration over time, revert to previous versions if needed, and collaborate with others on configuration management.&lt;/p&gt;

&lt;p&gt;• Repeatability and automation: With Deck, you can define your desired Kong configuration in a file. This makes it easy to deploy the same configuration across multiple environments (e.g., development, staging, production) or automate deployments using CI/CD pipelines.&lt;/p&gt;

&lt;p&gt;• Reduced errors: Manual configuration changes in Kong can be prone to errors. Deck allows you to define your configuration declaratively, reducing the risk of typos or inconsistencies.&lt;br&gt;
• Improved collaboration: Deck's declarative files make it easier for teams to collaborate on Kong configuration management. Everyone can see the desired state of the configuration in a single file.&lt;/p&gt;

&lt;p&gt;• Backup and disaster recovery: Deck allows you to easily export your Kong configuration to a file. This file can be used to back up your configuration or restore it in case of a disaster.&lt;/p&gt;

&lt;p&gt;• Simplified configuration management: Overall, Deck simplifies the process of managing Kong configurations by providing a centralized and automated approach. This can save time and effort for administrators.&lt;/p&gt;

&lt;p&gt;Install Deck:&lt;/p&gt;

&lt;p&gt;Want to get started with Deck?&lt;/p&gt;

&lt;p&gt;The official installation guide is available here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.konghq.com/deck/latest/installation/" rel="noopener noreferrer"&gt;https://docs.konghq.com/deck/latest/installation/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As I am on Windows, here are the specific commands to install Deck:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;download &lt;a href="https://github.com/kong/deck/releases/download/v1.35.0/deck_1.35.0_windows_amd64.tar.gz" rel="noopener noreferrer"&gt;https://github.com/kong/deck/releases/download/v1.35.0/deck_1.35.0_windows_amd64.tar.gz&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;curl -sL &lt;a href="https://github.com/kong/deck/releases/download/v1.35.0/deck_1.35.0_windows_amd64.tar.gz" rel="noopener noreferrer"&gt;https://github.com/kong/deck/releases/download/v1.35.0/deck_1.35.0_windows_amd64.tar.gz&lt;/a&gt; -o deck.tar.gz&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;mkdir deck&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;tar -xf deck_1.35.0_windows_amd64.tar.gz -C deck&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;powershell -command "[Environment]::SetEnvironmentVariable('Path', [Environment]::GetEnvironmentVariable('Path', 'User') + [IO.Path]::PathSeparator + [System.IO.Directory]::GetCurrentDirectory() + '\deck', 'User')"&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Ready to see Deck in action? Let's try out some commands and see how they interact with Kong.&lt;/p&gt;

&lt;p&gt;deck gateway ping:&lt;/p&gt;

&lt;p&gt;deck gateway ping is a specific command used to verify connectivity between Deck and Kong's Admin API.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz2cpi3g5db0qrt2fvdd4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz2cpi3g5db0qrt2fvdd4.png" alt="Image description" width="800" height="158"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now Let us create a service and a route.&lt;/p&gt;

&lt;p&gt;Here's how to define a service in your Deck state file:&lt;/p&gt;

&lt;p&gt;command:&lt;/p&gt;

&lt;p&gt;curl -i -X POST --url &lt;a href="http://localhost:8001/services/" rel="noopener noreferrer"&gt;http://localhost:8001/services/&lt;/a&gt; --data 'name=Testing1' --data 'url=&lt;a href="http://httpbin.org%5Cget" rel="noopener noreferrer"&gt;http://httpbin.org\get&lt;/a&gt;'&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd0dczkh3dkq0zegtt18x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd0dczkh3dkq0zegtt18x.png" alt="Image description" width="800" height="223"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Deck state file now includes the service definition for Kong.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgbe7fn58kj1jynnb91im.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgbe7fn58kj1jynnb91im.png" alt="Image description" width="611" height="114"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's define a route in Kong.&lt;/p&gt;

&lt;p&gt;curl -i -X POST --url &lt;a href="http://localhost:8001/services/Testing1/routes" rel="noopener noreferrer"&gt;http://localhost:8001/services/Testing1/routes&lt;/a&gt; --data 'name=Testing1_route' --data 'hosts[]=localhost:8000'&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsriqzftgnunynr2ouok1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsriqzftgnunynr2ouok1.png" alt="Image description" width="800" height="187"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Perfect! With the route definition in your Deck state file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpukagtc3857ddkcfmtd8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpukagtc3857ddkcfmtd8.png" alt="Image description" width="800" height="573"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;deck gateway dump:&lt;/p&gt;

&lt;p&gt;deck gateway dump --workspace default --output-file deck.yaml&lt;/p&gt;

&lt;p&gt;What this command will do it?&lt;/p&gt;

&lt;p&gt;The deck gateway dump command in Kong is used to export the entire configuration of your Kong Gateway instance into a local file. This file serves as a snapshot of your current Kong configuration, containing details about all entities like services, routes, plugins, consumers, and more.&lt;/p&gt;

&lt;p&gt;There is a slight change in command which is described below.&lt;/p&gt;

&lt;p&gt;• deck gateway dump: This specifies using the deck tool to perform a "dump" operation on your Kong Gateway configuration. Dumping refers to exporting the configuration data.&lt;/p&gt;

&lt;p&gt;• --workspace default: This option (with the flag --workspace) defines the workspace you want to target for the dump operation. Here, it's set to "default," which likely refers to the default workspace used by Deck in your environment.&lt;/p&gt;

&lt;p&gt;Workspaces are a Kong Gateway Enterprise feature that allows managing multiple configurations within the same Kong instance. If you're not using Kong Gateway Enterprise, this flag might be omitted.&lt;/p&gt;

&lt;p&gt;• --output-file deck.yaml: This option (with the flag --output-file) specifies the destination for the dumped configuration. Here, it's set to a file named "deck.yaml." This tells Deck to write the exported configuration data in YAML format to the "deck.yaml" file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi9c0j7z8vyjkf34cdlol.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi9c0j7z8vyjkf34cdlol.png" alt="Image description" width="708" height="34"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The deck.yaml file containing our Kong configuration has been successfully saved to our local machine.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqunu917bww7by0sjntop.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqunu917bww7by0sjntop.png" alt="Image description" width="800" height="28"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Checking the deck.yaml file confirms that the configuration for our Testing1 service has been successfully exported.&lt;/p&gt;

&lt;p&gt;Service&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8x0wcttce05iby2x8nvf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8x0wcttce05iby2x8nvf.png" alt="Image description" width="336" height="256"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Route&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgooj7blzhdpnnkg1zuy9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgooj7blzhdpnnkg1zuy9.png" alt="Image description" width="484" height="484"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's modify some aspects of the Testing1 service and its route within the Deck state file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F11yteybbhx4t8nd7lyx5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F11yteybbhx4t8nd7lyx5.png" alt="Image description" width="357" height="591"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The deck.yaml file has been updated! I've made some changes to the Testing1 service and route configuration, which are likely highlighted in yellow for clarity. Additionally, I've added a new path (/deck_testing) to the route definition.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzr68nvweiid9iy7tq3s7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzr68nvweiid9iy7tq3s7.png" alt="Image description" width="800" height="32"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I've refreshed the Kong Gateway, but the changes in the deck.yaml file don't seem to be reflected yet.&lt;/p&gt;

&lt;p&gt;Service configuration:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvgejh0iwfb1awd2zskry.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvgejh0iwfb1awd2zskry.png" alt="Image description" width="800" height="658"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Route configuration&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fki98x1p9p6pa20pxmc0r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fki98x1p9p6pa20pxmc0r.png" alt="Image description" width="800" height="568"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's now switch gears and talk about the deck gateway diff command.&lt;/p&gt;

&lt;p&gt;deck gateway diff:&lt;/p&gt;

&lt;p&gt;The deck gateway diff command in Kong is a vital tool for understanding the discrepancies between your desired Kong configuration and its current state.&lt;/p&gt;

&lt;p&gt;deck gateway diff essentially performs a dry run by comparing the configuration defined in your Deck state file with the actual configuration running on your Kong instance. It highlights any differences between:&lt;/p&gt;

&lt;p&gt;• Existing entities: Services, routes, plugins, consumers, and other entities defined in Kong.&lt;/p&gt;

&lt;p&gt;• Missing entities: Entities present in your Deck state file but not yet configured in Kong.&lt;/p&gt;

&lt;p&gt;• Modified entities: Entities that have different properties in your Deck state file compared to the running Kong instance.&lt;/p&gt;

&lt;p&gt;Benefits of using deck gateway diff:&lt;/p&gt;

&lt;p&gt;• Prevents unintended changes: By identifying differences beforehand, you can avoid accidentally applying unwanted configuration changes to your Kong instance.&lt;/p&gt;

&lt;p&gt;• Highlights configuration drift: It helps detect any manual modifications made directly to Kong's configuration, which can lead to inconsistencies with your desired state defined in the Deck file.&lt;/p&gt;

&lt;p&gt;• Improves debugging: If you encounter issues with your Kong setup, deck gateway diff can help pinpoint discrepancies between your intended configuration and the actual state.&lt;/p&gt;

&lt;p&gt;command:&lt;/p&gt;

&lt;p&gt;deck gateway diff --workspace default&lt;/p&gt;

&lt;p&gt;Thus, this command will create a service “Testing1_New” and route “Testing1_routeNew” which we had edited in the deck.yaml configuration file in the above steps.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feazwbtvkvzygtj2uub2m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feazwbtvkvzygtj2uub2m.png" alt="Image description" width="800" height="238"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's move on to step 4, where we'll use the deck gateway sync command&lt;/p&gt;

&lt;p&gt;deck gateway sync:&lt;/p&gt;

&lt;p&gt;The deck gateway sync command updates our Kong Gateway to reflect the settings we've defined in a separate file.&lt;/p&gt;

&lt;p&gt;command:&lt;/p&gt;

&lt;p&gt;deck gateway sync --workspace default deck.yaml&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnogoil27fxiaccorcran.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnogoil27fxiaccorcran.png" alt="Image description" width="800" height="235"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This command utilizes the deck tool to manage configurations in Kong Gateway and specifically targets a workspace and a state file. Let's break it down:&lt;/p&gt;

&lt;p&gt;• deck gateway sync: This specifies using the deck tool to perform a "sync" operation on your Kong Gateway configuration. Sync refers to synchronizing the configuration with the state file.&lt;/p&gt;

&lt;p&gt;• --workspace default: This option (with the flag --workspace) defines the workspace you want to target for the synchronization. Here, it's set to "default," which means Deck will focus on the default workspace within your Kong Gateway instance (if applicable). Workspaces are a Kong Gateway Enterprise feature for managing multiple configurations. If you're not using Kong Gateway Enterprise, this flag might be omitted.&lt;/p&gt;

&lt;p&gt;• deck.yaml: This refers to the state file containing your desired Kong Gateway configuration. It likely resides in the current directory where you're running the command.&lt;/p&gt;

&lt;p&gt;And now, if we sign in to Kong Manager, we can check whether or not the new route and service have been created.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3bl2fs4l5h029jt5gkz2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3bl2fs4l5h029jt5gkz2.png" alt="Image description" width="800" height="630"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo6009e2wee6rd1y4a77o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo6009e2wee6rd1y4a77o.png" alt="Image description" width="800" height="557"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff0tao8sf1y6gwotyfg6k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff0tao8sf1y6gwotyfg6k.png" alt="Image description" width="800" height="609"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thus, it is evident that Kong has invented a new service and route.&lt;/p&gt;

&lt;p&gt;deck gateway validate:&lt;/p&gt;

&lt;p&gt;The deck gateway validate command acts as a quality check for your Kong Gateway configuration defined in a Deck state file. Here's a breakdown:&lt;/p&gt;

&lt;p&gt;validate: This keyword indicates the action you want to perform, which is validation.&lt;/p&gt;

&lt;p&gt;What deck gateway validate does:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Reads the State File: The command reads the configuration details entirely from the specified Deck state file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Checks for Errors: It performs various checks on the configuration data within the file. Here are some potential validations:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;a.  Syntax Errors: Ensures the YAML or JSON format of the file is valid and free of any typos or syntax errors.&lt;/p&gt;

&lt;p&gt;b.  Missing References: Checks if all entities referenced in the configuration (e.g., a route referencing a specific service) actually exist in the state file itself. This helps identify potential configuration inconsistencies.&lt;/p&gt;

&lt;p&gt;c.  Internal Consistency: Validates if the configuration adheres to Kong's internal rules and logic. For example, checking if plugin configurations are compatible with the referenced services or routes.&lt;/p&gt;

&lt;p&gt;command:&lt;/p&gt;

&lt;p&gt;deck gateway validate --workspace default deck.yaml&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6gzbt85qpo93y2zw139q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6gzbt85qpo93y2zw139q.png" alt="Image description" width="625" height="44"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgvxdaf5w5afno0hg0w6t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgvxdaf5w5afno0hg0w6t.png" alt="Image description" width="702" height="39"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;deck gateway reset:&lt;/p&gt;

&lt;p&gt;The deck gateway reset command in Kong is a powerful but potentially destructive operation. It's used to completely wipe out the existing configuration of our Kong Gateway instance.&lt;/p&gt;

&lt;p&gt;What deck gateway reset does?&lt;/p&gt;

&lt;p&gt;This command essentially deletes all entities (services, routes, plugins, consumers, etc.) currently configured in our Kong Gateway instance. It essentially resets Kong to a blank slate, removing any existing API definitions, access controls, or plugin configurations.&lt;/p&gt;

&lt;p&gt;Important Considerations:&lt;/p&gt;

&lt;p&gt;• Irreversible Action: Unlike some other deck commands, deck gateway reset is an irreversible operation. Once executed, there's no way to recover the previous configuration without backups.&lt;/p&gt;

&lt;p&gt;• Use with Caution: Due to its destructive nature, it's crucial to use this command with extreme caution. It's recommended only for scenarios where you absolutely need to start fresh with a clean Kong Gateway configuration.&lt;/p&gt;

&lt;p&gt;• Alternative Approaches: Depending on your situation, alternative approaches might be more suitable:&lt;/p&gt;

&lt;p&gt;a.  deck gateway sync with an empty state file: If we want to remove all configurations from Kong, we can create a blank Deck state file (containing no entities) and use deck gateway sync with that file. This achieves the same outcome as deck gateway reset but allows us to potentially recover from accidental execution by keeping the blank state file as a reference.&lt;/p&gt;

&lt;p&gt;b.  Manual Configuration Removal: For smaller deployments, we might consider manually removing configurations through the Kong Admin API or the Kong Gateway interface.&lt;/p&gt;

&lt;p&gt;command:&lt;/p&gt;

&lt;p&gt;deck gateway reset --workspace default deck.yaml&lt;/p&gt;

&lt;p&gt;Deck documentation for Kong is available here: &lt;a href="https://docs.konghq.com/deck/latest/" rel="noopener noreferrer"&gt;https://docs.konghq.com/deck/latest/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Conclusion:&lt;/p&gt;

&lt;p&gt;This is an article about a tool called Deck. It helps manage Kong's configuration in a declarative way. Deck offers a variety of commands to accomplish this. Some of these commands help generate configuration files. Others help transform existing configurations. Still others help synchronize configurations with Kong. Overall, Deck seems to be a useful tool for managing Kong configurations.&lt;/p&gt;

</description>
      <category>kong</category>
      <category>deck</category>
      <category>kongapi</category>
      <category>cicd</category>
    </item>
    <item>
      <title>Demystifying Dynamic URLs: How to Build Them with Kong</title>
      <dc:creator>Deepanshu Pandey</dc:creator>
      <pubDate>Wed, 03 Apr 2024 09:38:56 +0000</pubDate>
      <link>https://dev.to/deepanshup04/demystifying-dynamic-urls-how-to-build-them-with-kong-2h94</link>
      <guid>https://dev.to/deepanshup04/demystifying-dynamic-urls-how-to-build-them-with-kong-2h94</guid>
      <description>&lt;p&gt;A dynamic URL is a web address that can change based on certain factors, unlike a static URL that remains constant. It's like a customizable address that adjusts depending on what you're looking for on a website. &lt;/p&gt;

&lt;p&gt;Here's a breakdown of how they work:&lt;/p&gt;

&lt;p&gt;• Components: Dynamic URLs typically include a base URL and a query string. The base URL is the core address of the website, while the query string contains specific instructions or data separated by "?" and "&amp;amp;" symbols.&lt;/p&gt;

&lt;p&gt;• Example: Imagine an online store. A static URL for a product might be &lt;a href="https://www.example.com/shoes/red-sneakers" rel="noopener noreferrer"&gt;https://www.example.com/shoes/red-sneakers&lt;/a&gt;. This works well for a single product. &lt;/p&gt;

&lt;p&gt;But with dynamic URLs, things get more flexible. The URL could look like &lt;a href="https://www.example.com/products?color=red&amp;amp;size=10" rel="noopener noreferrer"&gt;https://www.example.com/products?color=red&amp;amp;size=10&lt;/a&gt;. Here, "products" is the base URL, and the query string specifies "color=red" and "size=10".&lt;/p&gt;

&lt;p&gt;Static vs. Dynamic URLs: Choosing the Right Path for Your Website&lt;/p&gt;

&lt;p&gt;In the world of web development, URLs (Uniform Resource Locators) play a crucial role in directing users to specific content on your website. But not all URLs are created equal. &lt;/p&gt;

&lt;p&gt;We have two main categories: static URLs and dynamic URLs. Understanding the differences between them is essential for building an efficient and user-friendly website.&lt;/p&gt;

&lt;p&gt;Static URLs: The Simpler Sibling&lt;/p&gt;

&lt;p&gt;Imagine a static URL as a clear street address. It points directly to a specific location on your website, like a particular page or file. These URLs are typically easy to remember and manage.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  Benefits of Static URLs:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;• SEO Friendly: Search engines love static URLs because they're easy to crawl and understand. This can boost your website's ranking in search results.&lt;/p&gt;

&lt;p&gt;• Simpler Management: Static URLs are straightforward to manage and cache, making them ideal for smaller websites with relatively fixed content.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    Drawbacks of Static URLs:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;• Limited Flexibility: As your website grows, static URLs can become cumbersome. Imagine adding hundreds of products to an online store – each product would require a unique static URL, making maintenance a challenge.&lt;/p&gt;

&lt;p&gt;• Content Updates: Updating information across multiple static pages with the same content can be time-consuming.&lt;/p&gt;

&lt;p&gt;Dynamic URLs: Adapting to User Needs&lt;/p&gt;

&lt;p&gt;Dynamic URLs, on the other hand, are more like interactive maps. They can change based on user input, database queries, or server-side logic. This allows for a more dynamic and adaptable website experience.&lt;/p&gt;

&lt;p&gt;Advantages of Dynamic URLs:&lt;/p&gt;

&lt;p&gt;• Flexibility is Key: Dynamic URLs excel at handling vast amounts of content with a single route. This is perfect for websites with large databases or frequently changing content.&lt;/p&gt;

&lt;p&gt;• Personalized Experiences: By responding to user input, dynamic URLs can create a more personalized experience for each visitor. Imagine a news website displaying news relevant to your location or interests.&lt;/p&gt;

&lt;p&gt;• Streamlined Management: Adding or updating content becomes easier with dynamic URLs. You don't need to create a new URL for each change – the dynamic system takes care of it.&lt;br&gt;
Challenges of Dynamic URLs:&lt;/p&gt;

&lt;p&gt;• Complexity: Setting up dynamic URLs can involve more configuration and management compared to static ones.&lt;/p&gt;

&lt;p&gt;• SEO Considerations: While search engines have become adept at handling dynamic URLs, some SEO best practices need to be followed to ensure proper indexing.&lt;/p&gt;

&lt;p&gt;So, Which URL Should You Choose?&lt;/p&gt;

&lt;p&gt;The best choice depends on your website's specific needs:&lt;/p&gt;

&lt;p&gt;• Static URLs: Ideal for simple websites with fixed content or where SEO is a top priority.&lt;/p&gt;

&lt;p&gt;• Dynamic URLs: Perfect for websites with extensive content databases, user-generated content, or where personalization is important.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  Demystifying Dynamic Routing in Kong: A User-Centric Approach
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;At Kong, we frequently hear from customers and potential users about mastering dynamic routing based on URLs and headers. This blog post dives into various dynamic routing scenarios and explores how Kong empowers you to tackle them effectively.&lt;/p&gt;

&lt;p&gt;The Essence of API Gateways:&lt;/p&gt;

&lt;p&gt;An API gateway sits like a central hub, intelligently directing incoming requests to the appropriate backend service. In Kong, we represent these backend services as "Services”.&lt;/p&gt;

&lt;p&gt;Services: The Backbone of Routing:&lt;/p&gt;

&lt;p&gt;A Service object serves as the blueprint for an upstream API or service. Its core attribute is the URL, which defines where Kong should forward the traffic. This URL can be a simple string or a more granular configuration specifying protocol, host, port, and path components.&lt;/p&gt;

&lt;p&gt;The Power of Dynamic Routing:&lt;/p&gt;

&lt;p&gt;The default behavior is fantastic, but what if you need more flexibility? Dynamic routing in Kong allows you to go beyond static URLs and create routes that adapt based on specific elements within the URL and request headers. This unlocks a world of possibilities for managing complex API interactions.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   Next Steps:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In the following sections of this blog post, we'll delve into specific use cases for dynamic routing and showcase how Kong empowers you to implement them to create a robust and adaptable API layer.&lt;/p&gt;

&lt;p&gt;Hands-on with Kong Manager: Configuring Dynamic Routing&lt;/p&gt;

&lt;p&gt;Now, let's put theory into practice! We'll walk you through setting up dynamic routing in Kong Manager using an example.&lt;br&gt;
Imagine we have an API named "Dynamic_url" that acts as a middleman, forwarding requests to an upstream service located at &lt;a href="https://php-noise.com/noise.php" rel="noopener noreferrer"&gt;https://php-noise.com/noise.php&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Logging In and Setting Up:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Access Kong Manager: Head to your Kong Manager dashboard and log in.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose Your Workspace: Here we need to specify the workspace. I'll be working in the default workspace.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Navigate to Services: Click on the "Services" tab to manage your backend services.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Adding a New Service: Within the "Services" section, locate the "Add a Service" button and click on it.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Instead of defining a specific path segment in the service itself, I'll simply use a forward slash ("/") for the path. This way, I can achieve more flexibility by specifying the actual upstream path later using the Request Transformer plugin.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmfgolpa8t0kw6bckbo3e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmfgolpa8t0kw6bckbo3e.png" alt="Image description" width="576" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Continuing Our Kong Manager Setup: Creating the Route&lt;br&gt;
Now that we've created the "Dynamic_url" service representing our backend API, let's define a route within this service to handle dynamic routing. This route will tell Kong how to handle requests that include the path "/common".&lt;/p&gt;

&lt;p&gt;Connecting the Dots with a Route:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Accessing the Dynamic_url Service: Within Kong Manager, find the "Dynamic_url" service we just created. Click on it to access its details.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Adding a Route: Look for a button or option labeled "Add Route" or something similar. Click on it to initiate the route creation process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Naming the Route: Provide a descriptive name for your route. In this case, let's call it "Dynamic-Route" to reflect its purpose for testing dynamic routing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Defining the Path: Locate the field labeled "Path(s)". Here, we'll specify the path segment that will trigger this route. Enter /common in this field.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Specifying the HTTP Method: In addition to defining the path, Kong routes also allow you to specify the HTTP method that the route handles. Since we're focusing on fetching data from the "Dynamic_url" service, we'll use the GET method.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkrc72zgb85vrqiugwx6t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkrc72zgb85vrqiugwx6t.png" alt="Image description" width="652" height="560"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's move forward with enhancing our Kong route by incorporating three plugins: Basic Authentication, ACL, and Request Transformer. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq773a8097zr4gdtzkqon.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq773a8097zr4gdtzkqon.png" alt="Image description" width="736" height="747"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These plugins offer powerful functionalities to secure and manage your API traffic. Here's a breakdown of why each plugin is valuable:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Basic Authentication Plugin:
Purpose: This plugin adds a layer of security by requiring users to provide valid credentials (username and password) before accessing the route. This helps restrict access to authorized users only.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Why Use It: Let say our "Dynamic_url" service handles sensitive data, implementing basic authentication ensures only authorized users can interact with it. This helps prevent unauthorized access attempts.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpavwv9ioewng6s59uuni.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpavwv9ioewng6s59uuni.png" alt="Image description" width="779" height="719"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;ACL (Access Control List) Plugin:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Purpose: The ACL plugin provides fine-grained control over who can access the route. You can define rules based on factors like consumer credentials, IP addresses, or custom attributes.&lt;/p&gt;

&lt;p&gt;Why Use It: The ACL plugin goes beyond basic authentication by allowing you to create more granular access policies. You can define specific permissions for different users or groups, ensuring only those who meet the criteria can access the route.&lt;br&gt;
Let's refine the explanation of the ACL plugin configuration in our Kong route to specify the allowed consumer group.&lt;/p&gt;

&lt;p&gt;Focusing on the ACL Plugin:&lt;/p&gt;

&lt;p&gt;Within the ACL plugin configuration for our route, we’ll be defining an access control rule that specifically allows access to consumers belonging to the group named "consumer1".&lt;/p&gt;

&lt;p&gt;Why Consumer Group "consumer1"?&lt;br&gt;
Assuming you have a mechanism for managing consumer groups in Kong, this configuration restricts access to the route for the "Dynamic_url" service to only those consumers who are explicitly assigned to the "consumer1" group. This provides a controlled access layer for your API.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjersea5r2ozhcl1ogpag.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjersea5r2ozhcl1ogpag.png" alt="Image description" width="726" height="829"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Request Transformer Plugin:
Purpose: This plugin allows you to modify the request before it's forwarded to the upstream service. You can manipulate headers, parameters, or even the request body.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Why Use It: The Request Transformer plugin offers flexibility in how you prepare requests before sending them upstream. You can use it to:&lt;/p&gt;

&lt;p&gt;• Add or remove headers for specific purposes.&lt;/p&gt;

&lt;p&gt;• Modify request parameters based on routing logic.&lt;/p&gt;

&lt;p&gt;• Transform the request body to match the format expected by the upstream service.&lt;/p&gt;

&lt;p&gt;Now, to dynamically determine the path forwarded to the upstream service, we'll configure the Request Transformer plugin to modify the request URI. We'll specify the upstream path as "/noise.php" within the plugin.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbbwi8tgbnsj0794430vk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbbwi8tgbnsj0794430vk.png" alt="Image description" width="799" height="714"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By strategically using these plugins in your Kong route, we can create a secure and well-managed API environment for your "Dynamic_url" service.&lt;/p&gt;

&lt;p&gt;With a well-configured route and plugins in place, we need to define a consumer for this route. Think of a consumer as an entity that interacts with our Kong API. It could represent:&lt;/p&gt;

&lt;p&gt;• An external application: This could be a mobile app, another web service, or any external system that needs to access your API through Kong.&lt;/p&gt;

&lt;p&gt;• An internal application: Within your organization, different internal applications might require access to your API endpoints. Consumers allow you to manage access for each of these entities.&lt;/p&gt;

&lt;p&gt;Consumer and Security Configuration&lt;br&gt;
• Consumer "consumer1": We've created a consumer named "consumer1" in Kong. This consumer will represent the entity authorized to access the route.&lt;/p&gt;

&lt;p&gt;• ACL Plugin and Consumer Allowance: Within the ACL plugin configuration for the route, we’ve established a rule that specifically allows access for the "consumer1" consumer. This ensures only "consumer1" can interact with this route based on our chosen access control policy.&lt;/p&gt;

&lt;p&gt;• Basic Authentication User: An additional layer of security is implemented through basic authentication. I've created at least one basic authentication user (username and password combination). When the "consumer1" consumer attempts to access the route, it will need to provide valid credentials associated with this user to gain access.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F318j9exm4jqhwz01khdx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F318j9exm4jqhwz01khdx.png" alt="Image description" width="779" height="716"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that we've configured the route and security in Kong, it's time to test its functionality using Insomnia, a popular HTTP client. &lt;/p&gt;

&lt;p&gt;We'll focus on testing without enabling dynamic path manipulation for now.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxpw9qyowdn09n1x29941.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxpw9qyowdn09n1x29941.png" alt="Image description" width="747" height="252"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Test Results: Success!&lt;br&gt;
That's fantastic! Our testing in Insomnia has yielded positive results:&lt;/p&gt;

&lt;p&gt;• 200 OK Response: When we send a request to the route through Kong using Insomnia, we receive a 200 OK status code. This indicates successful communication and suggests Kong is functioning as expected, forwarding the request to the upstream service.&lt;/p&gt;

&lt;p&gt;• Consistent Response from Upstream: Additionally, if we directly access the upstream URL (php-noise.com/noise.php) outside of Kong, we receive the same 200 OK response. This confirms that the upstream service itself is also operational and returning the expected response.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1132l6lyozewzp74biss.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1132l6lyozewzp74biss.png" alt="Image description" width="550" height="463"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Testing the Local API (Static Parameters):&lt;br&gt;
Now that we understand the functionality of the URL, let's move forward with testing it in Insomnia (or your preferred HTTP client) to verify its behavior. In this initial test, we'll focus on using the URL exactly as provided, without enabling dynamic routing features in Kong.&lt;/p&gt;

&lt;p&gt;Here's what we're aiming to achieve:&lt;/p&gt;

&lt;p&gt;• Sending a Request: Make a request to the complete URL: &lt;a href="http://localhost:8000/common/noise.php?r=0&amp;amp;g=55&amp;amp;b=200&amp;amp;tiles=50&amp;amp;tileSize=7&amp;amp;borderWidth=0&amp;amp;mode=brightness&amp;amp;json" rel="noopener noreferrer"&gt;http://localhost:8000/common/noise.php?r=0&amp;amp;g=55&amp;amp;b=200&amp;amp;tiles=50&amp;amp;tileSize=7&amp;amp;borderWidth=0&amp;amp;mode=brightness&amp;amp;json&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;• Verifying Response: Observe the response from the script. Ideally, you should receive a 200 OK status code indicating successful communication. The response body should contain the generated noise data in JSON format, based on the parameters provided:&lt;/p&gt;

&lt;p&gt;• Color: Red (r=0), Green (g=55), Blue (b=200)&lt;br&gt;
• Tile layout: 50 tiles (tiles=50)&lt;br&gt;
• Tile size: 7 pixels each (tileSize=7)&lt;br&gt;
• No border (borderWidth=0)&lt;br&gt;
• Brightness mode (mode=brightness)&lt;/p&gt;

&lt;p&gt;By testing with the complete URL and its pre-defined parameters, we're establishing a baseline for the script's functionality without introducing dynamic elements through Kong. This will help us isolate any issues later when we incorporate dynamic routing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbke2i21lb37crxn9tml1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbke2i21lb37crxn9tml1.png" alt="Image description" width="740" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While the current response isn't what we ultimately aim for, it's understandable as we haven't implemented dynamic routing in Kong. Let's move on to that step.&lt;/p&gt;

&lt;p&gt;Enabling Dynamic Routing in Kong: Capturing the Path with (?\S*)&lt;/p&gt;

&lt;p&gt;Now that we've established a baseline for the local script's functionality, let's move forward and enable dynamic routing in Kong. This will allow us to capture a dynamic part of the URL path and use it to construct the upstream path for requests.&lt;/p&gt;

&lt;p&gt;Introducing the (?\S) Regular Expression:&lt;/p&gt;

&lt;p&gt;The first step involves adding a regular expression (?\S*) to our Kong route configuration. Let's break down this expression and understand its purpose:&lt;/p&gt;

&lt;p&gt;• (?: This part defines a capturing group named "path". Captured values within this group will be accessible later using the name "path".&lt;/p&gt;

&lt;p&gt;• \S*: This matches any sequence of non-whitespace characters (zero or more times). This captures the dynamic portion of the URL path that follows the static /common segment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhf13r0myh2mp1mo7l94n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhf13r0myh2mp1mo7l94n.png" alt="Image description" width="687" height="680"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Incorporating Captured Path into Upstream Path: Using $(uri_captures['path']) in Request Transformer&lt;br&gt;
Now that we've captured the dynamic path segment using the regular expression in the route, let's see how to utilize it to construct the upstream path dynamically. This is where the Request Transformer plugin and the expression $(uri_captures['path']) come into play.&lt;/p&gt;

&lt;p&gt;Understanding $(uri_captures['path']):&lt;/p&gt;

&lt;p&gt;• Accessing Captured Values: This expression acts as a placeholder within the Request Transformer plugin to access values captured by named groups in regular expressions within your routes.&lt;/p&gt;

&lt;p&gt;• Referencing the "path" Group: Specifically, $(uri_captures['path']) references the value captured by the "path" group in your route's regular expression.&lt;br&gt;
Dynamic Path Construction:&lt;/p&gt;

&lt;p&gt;Here's how this works in action:&lt;/p&gt;

&lt;p&gt;• Request Arrival: A request with a path like /common/data456 arrives at Kong.&lt;/p&gt;

&lt;p&gt;• Capturing Path Value: The route captures data456 in the "path" group.&lt;/p&gt;

&lt;p&gt;• Plugin Transformation: The Request Transformer plugin takes over. It replaces the static path in the request with a new path constructed using $(uri_captures['path']).&lt;/p&gt;

&lt;p&gt;• Dynamic Path Formation: The plugin replaces $(uri_captures['path']) with the actual captured value (data456), resulting in a new path, likely /noise.php in our case.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp6dlghmpxj9t8dqqubdw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp6dlghmpxj9t8dqqubdw.png" alt="Image description" width="777" height="760"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ready to Test with Dynamic Routing!&lt;/p&gt;

&lt;p&gt;With dynamic routing now enabled in Kong, we've reached an exciting stage. The regular expression in your route captures dynamic path segments, and the Request Transformer plugin utilizes $(uri_captures['path']) to construct the upstream path based on the captured value.&lt;/p&gt;

&lt;p&gt;Time for Insomnia Testing (Round 2):&lt;/p&gt;

&lt;p&gt;Let's revisit Insomnia and test the same API again:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://localhost:8000/common/noise.php?r=0&amp;amp;g=55&amp;amp;b=200&amp;amp;tiles=50&amp;amp;tileSize=7&amp;amp;borderWidth=0&amp;amp;mode=brightness&amp;amp;json" rel="noopener noreferrer"&gt;http://localhost:8000/common/noise.php?r=0&amp;amp;g=55&amp;amp;b=200&amp;amp;tiles=50&amp;amp;tileSize=7&amp;amp;borderWidth=0&amp;amp;mode=brightness&amp;amp;json&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnecaiw4ajnk8s19jr79q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnecaiw4ajnk8s19jr79q.png" alt="Image description" width="750" height="836"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Success! Dynamic Routing Delivers!&lt;/p&gt;

&lt;p&gt;That's fantastic news! By testing the API again in Insomnia we're now receiving the expected response. &lt;/p&gt;

&lt;p&gt;This successful test demonstrates that we've effectively implemented dynamic routing in Kong. Now, our API can handle requests with various path segments after "/common" and route them appropriately to our noise.php script for processing.&lt;/p&gt;

&lt;p&gt;Insomnia Test Round 3: Exploring Additional Parameters&lt;/p&gt;

&lt;p&gt;Now, let's move on to round 3 of testing in Insomnia to explore how the API handles additional parameters:&lt;/p&gt;

&lt;p&gt;New API:&lt;br&gt;
&lt;a href="http://localhost:8000/common/noise.php?hex=$%7Bhex%7D&amp;amp;json&amp;amp;base64" rel="noopener noreferrer"&gt;http://localhost:8000/common/noise.php?hex=${hex}&amp;amp;json&amp;amp;base64&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fekphhvo5hl4byh4imu0c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fekphhvo5hl4byh4imu0c.png" alt="Image description" width="782" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Excellent! The successful response from the API confirms that our dynamic routing configuration in Kong is functioning flawlessly.&lt;/p&gt;

&lt;p&gt;Conclusion: Mastering Dynamic Routing with Kong&lt;/p&gt;

&lt;p&gt;In this post, we've explored how to leverage Kong's dynamic routing capabilities to achieve flexible API routing. We started by establishing a baseline for a local script (noise.php) that generates visual noise data. Then, we configured Kong to dynamically handle requests with varying path segments:&lt;/p&gt;

&lt;p&gt;• Capturing Dynamic Paths: We utilized a regular expression in the route definition to capture dynamic portions of the URL path after a static prefix.&lt;/p&gt;

&lt;p&gt;• Request Transformation: The Request Transformer plugin played a crucial role. It dynamically modified the upstream path within the request based on the captured value using $(uri_captures['path']). This allowed Kong to route requests to the appropriate upstream service (noise.php) regardless of the specific path segment used.&lt;/p&gt;

&lt;p&gt;Benefits of Dynamic Routing:&lt;/p&gt;

&lt;p&gt;• Flexibility: Dynamic routing allows you to handle a wider range of URL structures within your API without requiring separate routes for each variation.&lt;/p&gt;

&lt;p&gt;• Maintainability: By using a single route with dynamic path capturing, you simplify Kong configuration and reduce the need for managing numerous static routes.&lt;/p&gt;

&lt;p&gt;• Control Over Upstreams: The captured path segment can be used not only for routing but also for manipulating other aspects of the request before forwarding it to the upstream service.&lt;/p&gt;

</description>
      <category>kong</category>
      <category>dynamic</category>
      <category>url</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
