
Serverless GraphQL @ Edge + Global DynamoDB Tables
Why? Mostly for fun. I don't see too many practical use cases for such setup. Lambda@Edges aren't suitable for a lot of cases due to limited memory and CPU, so they are slow. If you need a globally available website with dynamic content, you should consider going with JAMStack served via CloudFront, Vercel or Cloudflare.
Features
- Globally and highly available
- GraphQL Server at each of Edge locations using Lambda@Edge + CloudFront
- Globally replicated DynamoDB Tables
- GraphQL handlers routing to the closest DynamoDB table as persistence layer
- Pay-what-you-use model, no upfront or fixed charges, everything billed per-request
- Infra managed using AWS-CDK and Typescript
- Node functions packaged and minified automatically using Parcel, (there's a small bug though)
Useful commands
npm run buildcompile typescript to jsnpm run deploydeploy this stack to your default AWS account/region
Limitations
- Your server must be rather lightweight. Minified GraphQL Server code must be less than
1 MB. Lambda@Edge is restricted to128MBof memory and5000msof timeout forVIEWER_REQUESTintegration type. - Cannot use ENV variables
- Table name is hardcoded, gonna fix that
- Schema creation is laborious right now
Looking for cool DynamoDB editor? Check out Dynobase