examples
examples copied to clipboard
Provide example of using Pulumi to deploy NextJS app on AWS
Please provide an example of how to use Pulumi to deploy NextJS to AWS replicating how deployments work on Vercel infrastructure with edge network.
I'm looking for an example which replicates the same behavior as this component does for serverless.
I'm giving this a crack, starting with https://github.com/dealmore/terraform-aws-next-js
@thesobercoder According to this issue, there's a chance that v2 will come closer to what you (and me as well) desire.
A basic example—onto which we'd build later on—might be:
- Serving static content from CloudFront
- Deploying all api routes as a single Lambda
In theory, next build provides all things necessary for this to work.
for anyone struggling to find the answer to this like I was..I attempted to upload this to an S3 bucket, but struggled due to lack of information.
What worked for me:
- I ran
npm build && npm exportwhich generated the static HTML files for me. - Then I ran aws s3 sync ../{folder path}/ s3://$(pulumi stack output bucketName) --acl public-read
I can not find (and trust I have looked) any working example with pulumi. However, I have found a template to start from to begin the process. Scary stuff...
Any updates on this, using Pulumi not any other infra as code provider?
Thanks.
How critical is the advantage of the Edge deployment vs EC2/ECS + Cloudfront / Cloudflare? It seems like Next changes stuff so often that investing into Edge is not even worth it as much?
The PR at https://github.com/pulumi/examples/pull/1475 includes an example of a component that deploys the infrastructure needed to deploy a high-performance Next.js site on AWS using Pulumi. This leverages OpenNext which providers a more robust way to package Next.js builds for AWS (and AWS serverless specifically).