• Documentation
  • Pricing
© 2026 Serverless, Inc. All rights reserved.

Framework

  • Overview
  • Documentation
  • Plugins360
  • Pricing

Learn

  • Blog
  • GuidesUpdated
  • Examples240
  • Courses

Resources

  • Support
  • Security
  • Trust Center
  • Status

Community

  • Slack
  • GitHub47k
  • Forum
  • Meetups

Company

  • About
  • Careers
  • Contact
  • Partners

Legal

  • Terms of Service
  • Privacy Policy
  • Trademark
  • DMCA
Miguel Frazao

AWS Apollo Lambda (NodeJS & Typescript)

by

This example provides a setup for a Lambda Graphql API with apollo

  1. AWS Apollo Lambda (NodeJS & Typescript)

Apollo Lambda GraphQL API Example

Note: graphql is held at ^16.14.2 (not the current 17.x major) because @apollo/server's latest release (5.5.1) still declares a peerDependencies constraint of graphql: ^16.11.0. Bump this once @apollo/server adds graphql 17 support.

Note: TypeScript is intentionally held at 5.x — the TypeScript 7 native compiler isn't yet supported by the surrounding ecosystem tooling (checked 2026-07-20).

This example demonstrates how to setup a lambda graphql API with apollo

  • I used apiKeys to secure the endpoints but you can add custom authorizers

Use Cases

  • Small graphql API
  • Creating a temporary lambda API that can easily be converted to standard GraphQL API

Setup

  • Optionally set the following environment variables before deploying:

    • APOLLO_LAMBDA_KEY - value for the x-api-key header (defaults to your-api-key-that-is-at-least-characters-long if unset)
    • NODE_ENV - set to production to disable GraphQL introspection
  • sls deploy

Usage

  • To test it locally with serverless-offline by running: npm run dev
  • set x-api-key header with key your-api-key-that-is-at-least-characters-long

Future

  • Add support for subscription with Redis

Contents

  • Apollo Lambda GraphQL API Example
  • Use Cases
  • Setup
  • Usage
  • Future

Related

GuidesPluginsExamplesSlack CommunitySupport