DEV Community

Discussion on: How to Host a Static Website on AWS with HTTPS and CI/CD

Collapse
 
mjgs profile image
Mark Smith • Edited

When you say ‘second setup’ do you mean another GitHub action?

Ideally pushes to any branches but main would be built and deployed to a randomly generated subdomain.

I’ve got my blog on GitHub pages at the minute but I haven’t found a way to do branch previews, so I’m always having to test code in the live site.

Thread Thread
 
ara225 profile image
Anna Aitchison

I would have a second S3 bucket & Cloudront distribution setup to be accessable from a subdomain of your site - so basically the same setup, and have some logic in the Gitub Actions to deploy branches to random folders in the S3 bucket. Doing a new subdomain for each one would probaly be a lot harder, especially if you're not using Route53 for the domain as there's no easy way to automate that with most mainstream domain providers.

Thread Thread
 
mjgs profile image
Mark Smith

So a bit like having a staging and a production environment, then always deploy the non-main branches to staging, and staging environment is always accessible via the same subdomain (e.g. staging.example.com).

Is that what you mean?

I guess that could work as long as each developer had their own separate staging environment.

Thread Thread
 
ara225 profile image
Anna Aitchison

Yeah pretty much though you could go as complicated or as simple as you want.

Thread Thread
 
mjgs profile image
Mark Smith • Edited

Yeah I think fir solo devs it’s probably good enough to have just one staging env.

Though integrating route53 would be really awesome because you could send links to clients for them to test out work in progress, and have multiple preview branches live at the same time.

I’d love to see a simple and clear tutorial on how to use route53 in that way. Perhaps you can recommend one?