---
title: "Let Your AWS Lambdas Survive Thousands of Connections"
description: "Lambda's per-instance database connections can overwhelm Aurora Serverless v2 during traffic spikes, causing connection exhaustion, lingering zombie connections and cold-start latency, and RDS Proxy adds cost, pinning issues and borrow latency without fully fixing it."
url: "https://swe.quest/articles/let-your-aws-lambdas-survive-thousands-of-connections-95ac0e1f5340c6dd"
canonical: "https://neon.com/blog/survive-thousands-connections"
source: "Neon"
published: "2024-12-02"
difficulty: "medium"
kind: "How-to"
reading_minutes: 13
tags: ["serverless","postgres","cloud","javascript","scalability"]
---

# Let Your AWS Lambdas Survive Thousands of Connections

A post on [Neon](https://swe.quest/sources/neon.md), published 2024-12-02, 13 min read, How-to. Original: [https://neon.com/blog/survive-thousands-connections](https://neon.com/blog/survive-thousands-connections)

## Summary

Lambda's per-instance database connections can overwhelm Aurora Serverless v2 during traffic spikes, causing connection exhaustion, lingering zombie connections and cold-start latency, and RDS Proxy adds cost, pinning issues and borrow latency without fully fixing it. Neon's alternative is PgBouncer built into every endpoint in transaction pooling mode, enabled by adding '-pooler' to the hostname. It accepts up to 10,000 client connections, multiplexes them onto 64 server connections per user/database pair, and queues requests instead of rejecting them. A walkthrough builds a logistics API with a Postgres schema, node-postgres and the Serverless Framework to exercise the pooled setup.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Serverless](https://swe.quest/tags/serverless.md) (Backend & APIs)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Cloud platforms](https://swe.quest/tags/cloud.md) (Infrastructure)
- [JavaScript](https://swe.quest/tags/javascript.md) (Languages)
- [Scaling](https://swe.quest/tags/scalability.md) (Distributed systems)

## Prerequisites

- AWS Lambda basics ([easy posts on Cloud platforms](https://swe.quest/tags/cloud.md?difficulty=easy))
- Postgres connections ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- Node.js ([easy posts on JavaScript](https://swe.quest/tags/javascript.md?difficulty=easy))

## Keywords

AWS Lambda, Aurora Serverless v2, RDS Proxy, PgBouncer, Neon, Serverless Framework, node-postgres

## Related posts

- [PgBouncer is now available in Supabase](https://swe.quest/articles/pgbouncer-is-now-available-in-supabase-7611d240679e4c4c.md): Supabase · 2021-04-02 · Medium · 4 min read · PostgreSQL, Serverless, Scaling
  Supabase now bundles PgBouncer, co-located on the same server as each new project's Postgres, so serverless functions that open a connection per request don't overwhelm the database.
- [Simplify Serverless in AWS: How to Use Neon and Ephemeral Environments](https://swe.quest/articles/simplify-serverless-in-aws-how-to-use-neon-and-ephemeral-environments-81cd9c7a09760341.md): Neon · 2025-05-05 · Medium · 10 min read · PostgreSQL, Serverless, CI/CD, Testing, JavaScript
  Neon's serverless Postgres pairs well with ephemeral environments on AWS Lambda because each environment can get its own instant copy-on-write database branch without paying for extra RDS uptime.
- [Using Neon’s Scale to Zero with Long-Running Applications](https://swe.quest/articles/using-neon-s-scale-to-zero-with-long-running-applications-bbe64dd8466d86d8.md): Neon · 2024-01-24 · Medium · 7 min read · PostgreSQL, Serverless, Resilience, JavaScript, Performance engineering
  Neon's scale to zero suspends a Postgres compute after an idle window (only when no WAL senders are active and autovacuum isn't running), which severs connections held by long-running servers.
- [Supavisor: Scaling Postgres to 1 Million Connections](https://swe.quest/articles/supavisor-scaling-postgres-to-1-million-connections-8585e4b9712f0334.md): Supabase · 2023-08-11 · Medium · 7 min read · PostgreSQL, Elixir & Erlang, Scaling, Multi-tenancy, Performance engineering
  Supavisor is a multi-tenant Postgres connection pooler written in Elixir that Supabase built to replace single-threaded PgBouncer.
- [PGKeeper: Building the bouncer we needed for Postgres](https://swe.quest/articles/pgkeeper-building-the-bouncer-we-needed-for-postgres-b0a410376e101175.md): Figma · 2026-05-04 · Medium · 19 min read · PostgreSQL, Resilience, Go, Databases, Scaling
  Figma replaced PgBouncer with PGKeeper, a Go service built on PGX that sits between its DBProxy router and each Postgres instance.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
