Overview
S3 is the obvious place to host a static (frontend code only) website on AWS. It's a simple, serverless way to store and serve ...
For further actions, you may consider blocking this person and/or reporting abuse
Nice article, it’s good to have a clear and to the point explainer on how to set a basic static site up on AWS.
Do you happen to know if it’s possible to implement branch previews similar to the feature Netlify offers?
That's an interesting point. Off the top of my head, the easiest way to do it would probably be having a second setup on a subdomain and deploying previews to random paths in the S3 bucket by customizing the action. It's probably worth looking into other ways of handling this though - I'd imagine a good few people have already run into this.
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.
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.
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.
Yeah pretty much though you could go as complicated or as simple as you want.
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?
I'll do you one better, here's a CFN stack ready to go to automatically create the resources you need to run a site in S3. Just update the files in the
v1/
prefix in S3 and the site will be available.website CFN template
If you don't have a custom domain but instead just want to get a HTTPS certificate for your AWS bucket's website endpoints follow these steps:
Instructions from: aws.amazon.com/premiumsupport/know...
To find the url to your static site, open your CloudFront distribution and you should see the domain under "Domain Name". It should look something like
123whatever.cloudfront.net
.You should now be able to access your statically hosted site on S3 bucket via
https://123whatever.cloudfront.net/index.html
(Replace 123whatever with the subdomain that was given to you)Note: I noticed that you must specify the filename at the end of the url, so in this case index.html. If you don't do that you will get an error. Does anyone know how to fix this, so the site would be available via
https://123whatever.cloudfront.net/index.html
?Nice article. Another alternative to host a static or dynamic site is the new AWS Amplify. It's a plug and play system that does from the CI to the hosting.
Cheers
Seeing everything going on AWS is beggining to feel a bit dystopian
you could put it on Oracle or MS or Google..
(oh.. wait.. equally distopian ;) )
mkorostoff.github.io/1-pixel-wealth/
AWS is what makes Bezos so unfathomably wealthy.
Scenarios where everyone is using just one platform, a monopoly, are pretty freaky!
Interesting article. A nice addition would be to compare using AWS S3 to Github pages.