<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/scaling-kubernetes-pods-with-keda-based-on-amazon-sqs-queue-depth-i7d2zcmny" -->

---
title: Scaling Kubernetes pods with KEDA based on Amazon SQS...
description: CPU and memory metrics often fail to capture real workload pressure in event-driven Kubernetes systems. This guide walks through using KEDA (Kubernetes...
canonical: https://daily.dev/posts/scaling-kubernetes-pods-with-keda-based-on-amazon-sqs-queue-depth-i7d2zcmny
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Scaling Kubernetes pods with KEDA based on Amazon SQS queue depth | daily.dev
og:description: CPU and memory metrics often fail to capture real workload pressure in event-driven Kubernetes systems. This guide walks through using KEDA (Kubernetes...
og:url: https://daily.dev/posts/scaling-kubernetes-pods-with-keda-based-on-amazon-sqs-queue-depth-i7d2zcmny
og:image: https://api.daily.dev/og/posts/I7D2ZCmnY.png
og:image:alt: Scaling Kubernetes pods with KEDA based on Amazon SQS queue depth
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Scaling Kubernetes pods with KEDA based on Amazon SQS queue depth

**[CNCF](https://daily.dev/sources/cncf)** · 5 min read · 1 upvotes · 0 comments

## Summary

CPU and memory metrics often fail to capture real workload pressure in event-driven Kubernetes systems. This guide walks through using KEDA (Kubernetes Event-Driven Autoscaling) to scale worker pods based on Amazon SQS queue depth on EKS. It covers installation via Helm, IAM permissions with least-privilege access, configuring TriggerAuthentication and ScaledObject manifests, the replica calculation formula (ceil(outstanding messages / queueLength)), verification steps, common troubleshooting scenarios (no scale-out, too many pods, never scales to zero), and production tuning tips for cooldowns, HPA behavior, and in-flight message handling.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.cncf.io/blog/2026/07/31/scaling-kubernetes-pods-with-keda-based-on-amazon-sqs-queue-depth>

## Questions this post answers

### How does KEDA calculate the number of replicas needed based on SQS queue depth?

KEDA computes desired replicas as the ceiling of outstanding messages divided by the queueLength setting, where outstanding messages include ApproximateNumberOfMessages plus ApproximateNumberOfMessagesNotVisible (and delayed messages if enabled). For example, with queueLength set to 10, 8 messages yield 1 pod, 25 messages yield 3 pods, and 95 messages yield 10 pods, bounded by minReplicaCount and maxReplicaCount.

_Teams tuning queue-driven autoscaling can compare KEDA configuration approaches shared across daily.dev._

### Why do my KEDA-scaled pods never scale down to zero even when the SQS queue looks empty?

Pods often fail to scale to zero because of delayed or unacknowledged messages still counted as outstanding work, or because in-flight messages are being included in the replica calculation. Checking SQS queue attributes, application acknowledgment behavior, and the scaleOnInFlight setting alongside the visibility timeout typically reveals the cause.

_Developers debugging autoscaling quirks like this often track troubleshooting write-ups on daily.dev._

### What AWS IAM permissions does a KEDA SQS consumer need on Amazon EKS?

A worker consuming from SQS needs GetQueueAttributes, GetQueueUrl, ReceiveMessage, DeleteMessage, and ChangeMessageVisibility permissions scoped to the specific queue ARN, following least-privilege practice. KEDA authenticates using TriggerAuthentication with AWS pod identity rather than static credentials embedded in the deployment.

_Engineers wiring up least-privilege IAM for event-driven workloads can find similar setups on daily.dev._

## Similar posts on daily.dev

- [Autoscaling AI Workloads on Kubernetes With KEDA and What it Means for Agentic Systems](https://daily.dev/posts/autoscaling-ai-workloads-on-kubernetes-with-keda-and-what-it-means-for-agentic-systems-yomfl0hvk) · Cloud Native Now · 0 upvotes · 0 comments
- [KEDA: How Event-Driven Autoscaling Cuts Kubernetes Cost](https://daily.dev/posts/keda-how-event-driven-autoscaling-cuts-kubernetes-cost-dqoxqci3j) · Cast AI · 0 upvotes · 0 comments
- [Efficient autoscaling: Keeping performance, reliability, and cost in mind with open source projects](https://daily.dev/posts/efficient-autoscaling-keeping-performance-reliability-and-cost-in-mind-with-open-source-projects-khktb08fd) · CNCF · 1 upvotes · 0 comments
- [Comparison of Cluster Autoscaler and KEDA MachineSet Autoscaling on Red Hat OpenShift](https://daily.dev/posts/comparison-of-cluster-autoscaler-and-keda-machineset-autoscaling-on-red-hat-openshift-a0gl1jo2f) · Red Hat Developer · 0 upvotes · 0 comments
- [Operating Kubernetes at scale: a few stories from running Amazon EKS](https://daily.dev/posts/operating-kubernetes-at-scale-a-few-stories-from-running-amazon-eks-vdcgnhxcm) · The New Stack · 1 upvotes · 0 comments

---

Tags: [#aws](https://daily.dev/tags/aws), [#kubernetes](https://daily.dev/tags/kubernetes)

[View this post on daily.dev](https://daily.dev/posts/scaling-kubernetes-pods-with-keda-based-on-amazon-sqs-queue-depth-i7d2zcmny)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Scaling Kubernetes pods with KEDA based on Amazon SQS queue depth","url":"https://daily.dev/posts/scaling-kubernetes-pods-with-keda-based-on-amazon-sqs-queue-depth-i7d2zcmny","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/scaling-kubernetes-pods-with-keda-based-on-amazon-sqs-queue-depth-i7d2zcmny"},"datePublished":"2026-07-31T11:04:29.997Z","dateModified":"2026-09-14T08:22:22.257Z","description":"CPU and memory metrics often fail to capture real workload pressure in event-driven Kubernetes systems. This guide walks through using KEDA (Kubernetes...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/af85a1852416ce4108c1193b81309ea2?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/af85a1852416ce4108c1193b81309ea2?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"CNCF","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"CNCF","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/55536a03390741eebd96d2f9b74d2d8d","url":"https://daily.dev/sources/cncf"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/scaling-kubernetes-pods-with-keda-based-on-amazon-sqs-queue-depth-i7d2zcmny","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"aws,kubernetes","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"CNCF","item":"https://daily.dev/sources/cncf"},{"@type":"ListItem","position":3,"name":"Scaling Kubernetes pods with KEDA based on Amazon SQS queue depth"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/scaling-kubernetes-pods-with-keda-based-on-amazon-sqs-queue-depth-i7d2zcmny#faq","mainEntity":[{"@type":"Question","name":"How does KEDA calculate the number of replicas needed based on SQS queue depth?","acceptedAnswer":{"@type":"Answer","text":"KEDA computes desired replicas as the ceiling of outstanding messages divided by the queueLength setting, where outstanding messages include ApproximateNumberOfMessages plus ApproximateNumberOfMessagesNotVisible (and delayed messages if enabled). For example, with queueLength set to 10, 8 messages yield 1 pod, 25 messages yield 3 pods, and 95 messages yield 10 pods, bounded by minReplicaCount and maxReplicaCount. Teams tuning queue-driven autoscaling can compare KEDA configuration approaches shared across daily.dev."}},{"@type":"Question","name":"Why do my KEDA-scaled pods never scale down to zero even when the SQS queue looks empty?","acceptedAnswer":{"@type":"Answer","text":"Pods often fail to scale to zero because of delayed or unacknowledged messages still counted as outstanding work, or because in-flight messages are being included in the replica calculation. Checking SQS queue attributes, application acknowledgment behavior, and the scaleOnInFlight setting alongside the visibility timeout typically reveals the cause. Developers debugging autoscaling quirks like this often track troubleshooting write-ups on daily.dev."}},{"@type":"Question","name":"What AWS IAM permissions does a KEDA SQS consumer need on Amazon EKS?","acceptedAnswer":{"@type":"Answer","text":"A worker consuming from SQS needs GetQueueAttributes, GetQueueUrl, ReceiveMessage, DeleteMessage, and ChangeMessageVisibility permissions scoped to the specific queue ARN, following least-privilege practice. KEDA authenticates using TriggerAuthentication with AWS pod identity rather than static credentials embedded in the deployment. Engineers wiring up least-privilege IAM for event-driven workloads can find similar setups on daily.dev."}}]}
```

