This example shows you how to deploy your Next.js app on AWS Cloudfront.
- Fork this repository
- Create a Lifecycle Job
- Select your forked repository with the appropriate branch (e.g.
main
) - Set the "Root application path" to the example you want to use (e.g.
examples/deploy-nextjs-app-on-cloudfront
) - Set the "Dockerfile path" to the Dockerfile in the example you want to use (e.g.
Dockerfile
) - Select "Start" event and add the following CMD Arguments:
["upload.sh"]
- which indicates to the Lifecycle Job to run theupload.sh
script when the Lifecycle Job starts. - Create your Lifecycle Job but do not deploy it yet.
- Go to your Lifecycle Job variables and create:
AWS_ACCESS_KEY_ID
environment variable alias to provide toupload.sh
your AWS access key ID.AWS_SECRET_ACCESS_KEY
environment variable alias to provide toupload.sh
your AWS secret access key.AWS_DEFAULT_REGION
environment variable alias to provide toupload.sh
your AWS default region.AWS_BUCKET_NAME
environment variable alias to provide toupload.sh
your AWS S3 bucket name.AWS_CLOUDFRONT_DISTRIBUTION_ID
environment variable alias to provide toupload.sh
your AWS Cloudfront distribution ID.
- Deploy your Lifecycle Job.
Your NextJS app is now deployed on AWS with Cloudfront.