Kong Lambda Plugin

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up the kong lambda plugin by linking an API route to a cloud function. This plugin sends incoming web traffic straight to your serverless code without extra servers. Engineering teams use this setup to expose cloud functions as standard web endpoints. They often attach a single cloud role or static key to the route. When that role has broad permissions, one bad request can trigger unintended actions across your cloud account. How the kong lambda plugin works in practice The kong lambd

Kong Security Plugins + Lambda Execution Roles: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

You set up the kong lambda plugin by linking an API route to a cloud function. This plugin sends incoming web traffic straight to your serverless code without extra servers. Engineering teams use this setup to expose cloud functions as standard web endpoints. They often attach a single cloud role or static key to the route. When that role has broad permissions, one bad request can trigger unintended actions across your cloud account.

How the kong lambda plugin works in practice

The kong lambda plugin runs inside your API routing tier and listens for web requests. When a client sends a request, the plugin pauses the normal routing flow. It packs the request headers, body, and query data into a JSON payload. Then it calls the cloud provider API to run your target function.

To make this call, the plugin needs permission from your cloud provider. Teams grant this permission using static cloud keys or an attached machine role. The cloud provider checks the role and runs the function code. Once the function finishes, it sends a response back to the plugin. The plugin turns that output into a standard HTTP response for the client.

You can attach this plugin to a single route or a whole service. You can also tie it to a specific consumer group for better control. This flexibility lets teams mix serverless functions and traditional backend services under one domain.

Managing cloud roles and function invocation rules

Securing this workflow starts with how your API nodes talk to your cloud account. Storing static cloud keys inside plugin settings creates a big risk for your team. If someone reads your admin API, they can copy those keys and use them anywhere. Using an inherited machine role or workload identity is a much safer choice.

Even with role inheritance, teams often make the attached role too broad. A single cluster might run dozens of functions for different internal apps. Giving the cluster role permission to invoke every function makes setup fast. Still, this means any compromised route can trigger sensitive backend functions by mistake. Teams should scope each role down to the exact function it needs to run.

Payload formatting is another detail that requires careful setup by your engineers. The plugin can forward the raw request or wrap it with metadata. Your function code must match this exact format, or the run will fail. Teams must align their route settings with what the function code expects to read.

Kong Security Plugins + Lambda Execution Roles: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What the native setup solves and where gaps remain

This native integration solves the problem of exposing serverless code to external web clients. It handles HTTP translation, rate limits, and basic client login checks in one place. Your developers do not need to write custom web servers just to run small tasks.

Still, the native setup only controls how the route starts the cloud function. It does not inspect what happens when engineers or automated tools debug those functions directly. Once a function runs, it often reads databases or calls other internal services. Role setup decides who logs in, not what individual statements or requests do in flight.

When a function returns data, the basic routing workflow passes the payload right back. If that response contains emails, phone numbers, card numbers, or national IDs, the raw data leaves your network. Teams still need a way to inspect payloads and mask sensitive fields in results. They also need clear audit logs when engineers run backend tasks outside the public API.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

How does the plugin authenticate with the cloud provider?

The plugin can use static access keys saved in its settings or inherit a machine role from the host node. Most security teams prefer host roles so they do not have to rotate static keys by hand.

Can the plugin send request headers and query strings to the function?

Yes, you can set the plugin to bundle headers, query parameters, and the request body into the JSON event. This lets your function code read the full context of the original HTTP call.

What happens when a serverless function takes too long to run?

If the function takes longer than the timeout limit set on the route, the client gets a timeout error. The cloud function might still finish its run in the background even after the web connection drops.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.