Examples

June 3, 2026 ยท View on GitHub

Runnable, copy-pasteable example projects for serverless-appsync-plugin.

Each subfolder is a complete Serverless Framework project that you can:

  1. Read to learn how to configure a specific feature
  2. Copy as a starting point for your own project
  3. Deploy with serverless deploy to see it work on real AWS

These examples are also used as fixtures by the plugin's CFN synthesis test suite, so they're guaranteed to stay current with the plugin's actual behavior โ€” if they break, CI fails.

Index

ExampleWhat it shows
basic-api-keySimplest possible setup: API key auth, one DynamoDB data source, one resolver
cognito-userpoolsCognito User Pools authentication with default action and user groups
iam-authAWS IAM authentication
oidc-authOpenID Connect authentication
lambda-authorizerCustom AWS Lambda authorizer
multi-authMultiple authentication providers (API Key primary + Cognito + IAM additional)
lambda-resolvers-jsJS resolvers bundled with esbuild + Lambda data sources
lambda-resolvers-vtlVTL request/response mapping templates
pipeline-resolversPipeline resolvers with reusable functions
datasource-httpHTTP data source with optional IAM signing
datasource-noneNONE data source (local resolvers)
datasource-eventbridgeEventBridge data source
datasource-bedrockAmazon Bedrock runtime data source for synchronous model invocations
datasource-opensearchAmazon OpenSearch Service data source
datasource-rdsRelational Database (Aurora Serverless) data source
cachingServer-side caching configuration
wafAWS WAF v2 rules attached to the API
logging-xrayField-level logging plus X-Ray tracing
custom-domainCustom domain with route53 record management
introspection-disabledDisabled introspection and query depth limit
substitutionsVTL ${variable} substitutions in resolvers
environment-variablesEnvironment variables for JS resolvers
api-keys-multipleMultiple API keys with different expiry policies
tagsResource tagging on the AppSync API
visibility-privatePRIVATE API visibility for VPC-only access
schema-multiple-filesSchema split across multiple .graphql files
sync-config-versionedDynamoDB conflict resolution (OPTIMISTIC_CONCURRENCY + AUTOMERGE) with delta sync
custom-domain-no-cfnCustom domain managed outside CloudFormation (via the plugin's CLI commands)
waf-pre-existing-arnAttach a pre-existing shared WAF WebACL by ARN
pipeline-resolver-with-codePipeline resolver with its own top-level JS (before/after handlers) plus per-function code
api-key-import-existingImport an existing API key by ID (stable migration) alongside auto-generated keys

How to run an example

Pick one, cd into it, then:

npm install
serverless deploy

You'll need AWS credentials configured and serverless installed globally or available via npx.

How they fit into the test suite

Each example is exercised by a test in e2e/ that runs serverless package (CloudFormation synthesis without deploying) and asserts on the generated CloudFormation template. This catches breakages at compile time without requiring AWS credentials in PR CI.

See e2e/README.md for details.