---
title: "Simplify Serverless in AWS: How to Use Neon and Ephemeral Environments"
description: "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."
url: "https://swe.quest/articles/simplify-serverless-in-aws-how-to-use-neon-and-ephemeral-environments-81cd9c7a09760341"
canonical: "https://neon.com/blog/ephemeral-environments-aws-serverless"
source: "Neon"
published: "2025-05-05"
difficulty: "medium"
kind: "How-to"
reading_minutes: 10
tags: ["postgres","serverless","ci-cd","testing","javascript"]
---

# Simplify Serverless in AWS: How to Use Neon and Ephemeral Environments

A post on [Neon](https://swe.quest/sources/neon.md), published 2025-05-05, 10 min read, How-to. Original: [https://neon.com/blog/ephemeral-environments-aws-serverless](https://neon.com/blog/ephemeral-environments-aws-serverless)

## Summary

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. Compared with Aurora Serverless v2, Neon claims ~500ms cold starts versus 15s, built-in PgBouncer supporting 10,000 connections, and an HTTP/WebSocket data API. A TODO API built with the Serverless Framework shows how the serverless driver's sql template tag guards against SQL injection, but only when called directly on a string literal, and how sql.query with $n placeholders handles dynamic updates. Scripts and GitHub Actions create a branch per feature or CI run, run unit and end-to-end tests against it, then tear down both the stack and the branch.

Written by swe.quest, not by the author.

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

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Serverless](https://swe.quest/tags/serverless.md) (Backend & APIs)
- [CI/CD](https://swe.quest/tags/ci-cd.md) (Reliability & operations)
- [Testing](https://swe.quest/tags/testing.md) (Engineering practices)
- [JavaScript](https://swe.quest/tags/javascript.md) (Languages)

## Prerequisites

- AWS Lambda basics ([easy posts on Cloud platforms](https://swe.quest/tags/cloud.md?difficulty=easy))
- Serverless Framework ([easy posts on Serverless](https://swe.quest/tags/serverless.md?difficulty=easy))
- PostgreSQL basics ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- GitHub Actions ([easy posts on CI/CD](https://swe.quest/tags/ci-cd.md?difficulty=easy))

## Keywords

Neon, AWS Lambda, Serverless Framework, Aurora Serverless v2, PgBouncer, GitHub Actions, Neon serverless driver

## Related posts

- [Neon Functions: backend logic next to your data](https://swe.quest/articles/neon-functions-backend-logic-next-to-your-data-fe00336dce0040ff.md): Neon · 2026-08-12 · Medium · 5 min read · Serverless, PostgreSQL, Real-time systems
  Neon Functions are long-running Node.js 24 compute deployed onto a Neon branch, in the same region and on the same infrastructure as its Lakebase Postgres database, with DATABASE\_URL and other Neon backend credentials injected automatically.
- [SELECT ’Hello, World’](https://swe.quest/articles/select-hello-world-151ac208b5f708c9.md): Neon · 2022-06-15 · Easy · 5 min read · PostgreSQL, Storage engines, Serverless, Cloud platforms, Multi-tenancy
  Neon is a serverless Postgres service built on separated storage and compute, launching behind a waitlist.
- [How Cedalio uses Neon for an efficient development workflow](https://swe.quest/articles/how-cedalio-uses-neon-for-an-efficient-development-workflow-265835e6a16f5a00.md): Neon · 2024-05-29 · Easy · 5 min read · PostgreSQL, CI/CD, Multi-tenancy, Serverless
  Cedalio, an ESG data verification startup, moved from DynamoDB to Postgres and picked Neon over RDS for a simpler API and console.
- [Fullstack Serverless CI/CD in AWS Amplify Hosting with Postgres Database Branching](https://swe.quest/articles/fullstack-serverless-ci-cd-in-aws-amplify-hosting-with-postgres-database-5ab5e970ace5ba81.md): Neon · 2024-03-06 · Medium · 10 min read · CI/CD, PostgreSQL, Serverless, Cloud platforms, Deployment
  Each AWS Amplify Hosting app branch can get its own isolated Neon Postgres database branch, created automatically during CI/CD by a custom neon-ci.sh script that calls the Neon CLI and writes the branch connection string into DATABASE\_URL in a .env file.
- [Let Your AWS Lambdas Survive Thousands of Connections](https://swe.quest/articles/let-your-aws-lambdas-survive-thousands-of-connections-95ac0e1f5340c6dd.md): Neon · 2024-12-02 · Medium · 13 min read · Serverless, PostgreSQL, Cloud platforms, JavaScript, Scaling
  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.

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)
