AWS Waf Rules for API Gateway Fronting EKS Ingress

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up aws waf rules for api gateway fronting eks ingress by attaching a web ACL to your stage. These rules filter bad web traffic before requests reach your Kubernetes cluster. Most teams start by blocking common SQL patterns, bad bots, and high request rates. They route clean traffic from the API stage to an internal load balancer. That load balancer forwards packets to the cluster ingress controller. Still, perimeter rules only inspect public web requests from outside users. If internal r

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up aws waf rules for api gateway fronting eks ingress by attaching a web ACL to your stage. These rules filter bad web traffic before requests reach your Kubernetes cluster. Most teams start by blocking common SQL patterns, bad bots, and high request rates. They route clean traffic from the API stage to an internal load balancer. That load balancer forwards packets to the cluster ingress controller. Still, perimeter rules only inspect public web requests from outside users. If internal roles stay too broad, engineers and services still hold wide cluster power.

How aws waf rules for api gateway fronting eks ingress work

Traffic hits the edge firewall first when a client calls your API. The firewall checks headers, body text, and source IP addresses against your rule list. You can group rules to stop cross-site scripts and volumetric floods. If a request matches a block rule, the edge drops it right away. Valid requests pass through the API stage and cross a private link. They land on the ingress pods running inside your Kubernetes namespaces.

Inside the cluster, Kubernetes RBAC controls what users and service accounts can do. A Role sets permissions within one namespace, while a ClusterRole covers the whole cluster. RoleBindings and ClusterRoleBindings attach these permission sets to specific users or groups. Because Kubernetes RBAC rules are purely additive, there are no deny rules. Teams must design each role with care so accounts only get needed rights.

Why edge filtering leaves an internal Kubernetes gap

Edge rules protect public routes from external attackers. They do not inspect what developers or support staff do inside the cluster. Engineers still need direct cluster sessions to fix bugs, check pod logs, or run commands. In Kubernetes RBAC, pod logs and command execution are subresources on the pod API. Once a role grants pod exec rights, the user can run any shell command inside that container.

Perimeter firewalls never see this internal traffic because it goes straight to the Kubernetes API server. Native RBAC decides who can log in and start a session. It cannot check individual commands in flight or rewrite sensitive output fields. If a pod prints customer emails, phone numbers, or card numbers, raw logs expose them. Teams also struggle when they share static cluster keys across many developer laptops. Rotating those keys takes time and often breaks active debug work.

AWS WAF + API Gateway (Kong, Envoy): architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Managing internal cluster commands and sensitive data

To close this gap, platform teams separate public web security from internal cluster operations. Keep edge rules focused on rate limits, payload size, and common web exploits. For internal work, replace wide cluster bindings with tighter controls at the command level. Every action against a pod or database inside the cluster should link to one person. Teams also apply data masking to rewrite matched fields like national IDs in results. This approach keeps both the public edge and internal cluster work safe.

Govern kubectl and API calls in flight

Identity providers and Kubernetes RBAC decide who logs into a cluster. They cannot redact keys inside returned JSON objects or hold a risky delete call for review. By design, hoop.dev runs as an open-source proxy, a sidecar for your Kubernetes API, checking requests and responses without replacing RBAC.

First, hoop.dev guardrails refuse banned methods, paths, or headers before they run. Next, hoop.dev data masking rewrites sensitive keys in returned Secret, ConfigMap, and log responses in memory, and writes each decision to the audit trail. Explore the repo on GitHub.

Frequently asked questions

Do edge firewall rules protect the Kubernetes API server?

No, edge rules only filter traffic flowing through your public API routes. Engineers talking to the Kubernetes API server bypass the public ingress path completely.

Can Kubernetes RBAC block specific shell commands inside a pod?

No, Kubernetes RBAC only controls whether a user can call the pod exec subresource. Once the session starts, RBAC cannot filter which shell commands the user runs.

Should I put rate limits in the edge firewall or the ingress controller?

Put broad rate limits at the edge to drop floods before they reach your network. Use ingress settings for fine routing rules between internal services and namespaces.

The query runs. The emails stay hidden.