To deploy SAM template to stack:
sam build
sam deploy
Upload index and website files to bucket
aws s3 cp static/. s3://anebz/ --recursive
Now these steps are done through Github Actions 🚀
Removing front-end resources from template because some things can't be done via code:
- S3: create bucket and upload files (via template)
- Route 53: create domain, which creates hosted zone
- We will need A type route and CNAME type route
- Certificate Manager: create certificate for domain
- Request public certificate: SSL/TLS
- Select domain
- DNS validation
- When the certificate says: pending approval or similar, click on the create Record on Route 53. This will create CNAME route
- Cloudfront distribution: create distribution
- Origin domain: select the S3 suggestion but instead of BUCKETNAME.s3.REGION.amazonaws.com, change it to BUCKETNAME.s3-website.REGION.amazonaws.com
- Viewer protocol policy: Redirect HTTP to HTTPS
- Alternate domain name (CNAME): add the domain name
- Custom SSL certificate: add the certificate from the suggestions
- Leave HTTP/s enabled
- Leave IPv6 On
- Create, it takes some minutes to deploy
- After this, an A type route is created in the hosted zone from Route 53
- Go to the domain name and you should see that the website has HTTPS