How to host your static website on AWS S3 with your own HTTPS domain name (with a Next JS example)

Published: 01 January 1970
on channel: Kodaps Academy
1,360
29

This video supposes you have your domain name and that it is managed in Route 53, if you have questions about doing that leave a message in the comments.
The script I use at the end is here: https://gist.github.com/Gosev/e04abeb...
The seven steps are:
Step 1: create the S3 bucket with the domain name you want to use
Step 2: create the CloudFront CDN distribution for the new bucket
Step 3: add the domain in the CNAME in the distribution and request an SSL certificate with the Certificate Manager
Step 4: Create a record in Route 53 that points to the CloudFront distribution
Step 5: Build the app with yarn export, go into the build directory and and upload it using :
aws s3 cp . s3://S3_BUCKET/ --recursive --profile=PROFILE --acl=public-read
Step 6: If it doesn't work with dynamic paths, make sure the trailing slash is set to true in the nextjs.config, and run the script which will copy all the FOLDER/index.html files to FOLDER