nextjs-aws-cdk
nextjs-aws-cdk copied to clipboard
An AWS-CDK deployment of NextJS using @sls-next/lambda-at-edge
NextJS Serverless CDK
A CDK deploy to cloudfront distributions of https://github.com/vercel/next.js using https://github.com/serverless-nextjs/serverless-next.js for AWS compatibility.
This is a spike of an Application, not a construct.
There are no defined caching strategies and all s3 assets are purged for every deploy
Experimental AWS-CDK constructs have been used, see:
Official Support
Serverless next JS has a construct for this now: https://github.com/serverless-nextjs/serverless-next.js/pull/878
Example
The example page is here - https://d3a8vzm1ccycvj.cloudfront.net/
Features
- [ ] CDK Synth builds nextJS application using @sls-next/lambda-at-edge
- [ ] Support for API pages using @sls-next/lambda-at-edge
- [ ] Deploys Lambda at edge and S3 Assets using AWS-CDK.
- [ ] Routing and caching configuration is extensible through AWS-CDK cloudfront behaviors.
Deploy
- Deploys to
us-east-1
- Uses cloudformation single stack as resource limit has recently be raised from 200 to 500
export AWS_PROFILE=<your-aws-profile>
yarn cdk bootstrap
yarn build
yarn cdk synth
yarn cdk deploy
Removing
export AWS_PROFILE=<your-aws-profile>
yarn cdk destroy