Notes on Setting Up a Static Website With AWS (Route 53, S3, ACM)
Published on SepĀ 4, 2024 (updated SepĀ 18, 2024), filed under development (feed). (Share this on Mastodon orĀ Bluesky?)
After Cloudflare came AWS. This time not merely putting a service in front of a website, I wanted to test the whole process around setting up a full-blown static website on AWS.
Superquick notes againāhappy if anything helps, also happy if I can learn something from you.
Flying start: For most purposes, Configuring a Static Website Using a Custom Domain Registered With RouteĀ 53 is a great guide. The tutorial walks through getting the domain, setting up S3 buckets, uploading files, and testing.
To set up SSL, however, the AWS tutorial falls short. How to Set Up an AWS S3 Static SSL Website helps, until it doesnāt anymore:
To properly set up SSL via CloudFront, you need a certificate in us-east-1, and if you hadnāt set the certificate(s) up in that region, you cannot copy or import the respective certificatesāyou need to request them again in us-east-1.
To make this all work, now, itās necessary to go back to RouteĀ 53, to update the A records to point to the CloudFront distribution(s), as opposed to the S3 buckets. (Thank you, Avinash Dalvi and Stack Overflow.)
āļø (If thatās your cup of tea, too, you can use Transmit to connect and upload to S3.)
Setting up redirects is awkward. Here, too, Amazonās documentation gives a leg up with Configuring a Webpage Redirect, but it could offer better examples, including a quick one for external redirects. Angelo Mandatoās URL Redirection on AWS Using JSON Rules helped with that. (Why awkward? Redirects should be closer to the source to be usable, I think, and the syntax can and should be simpler.)
Setting custom HTTP headers seems possible but looks verbose. Iām also not sure about automated invalidation when uploading new content, but that, too, seems possible. I stopped here.
Is AWS Worth It?
Is it worth setting up a static website on AWS? Before sharing my view on this, here are the pros and cons I see in doing so:
Pros
Stellar global performanceāfrom the tests I ran using WebPageTest, AWS is, on international average, twice as fast as my shared hosting providers (even when the respectives test sites already used CloudFront). Performance is also largely equal and consistent across the globe. AWS is really good (thatās why we use them in so many commercial setups, sure).
(Estimated) low costāfrom my experience using CloudFront (where I pay 2 cents per month for all my websites), AWS is likely a lot cheaper than any āstandardā hosting provider.
Cons
- Poor usability and DX. AWS is terrible to use. Yes, you can learn and get used to it. But that doesnāt change the fact that itās terrible to use. The setup is complicated, involving 5+ AWS products (more if you also want to set up budget control, user access, and security), and the way cache invalidations, headers, redirects work is all way too convoluted. Even once you have it all set up and figured out, it will probably feel brittle.
But, is it worth it?
I think only if you have an international audience and a lot of traffic. (What āa lotā is, is up to you.)
Personally, which I cannot separate from professionally here, Iām now tearing down my tests, and will for the moment not run my sites entirely on AWS. But, I think itās a real and likely option for me to move select projects here in a few years, like meiert.com as well as Frontend Dogma. Yet thatās going to be a time investment, and the sites arenāt at the point yet where that has to happen.
That has been my experience, thatās my view at the momentāas mentioned in the beginning, great if something in here has been useful for you, and let me know if you think something could be of interest for me to know! Cheers!
About Me
Iām Jens (long: Jens Oliver Meiert), and Iām a web developer, manager, and author. Iāve been working as a technical lead and engineering manager for companies youāve never heard of and companies you use every day, Iām an occasional contributor to web standards (like HTML, CSS, WCAG), and I write and review books for OāReilly and Frontend Dogma.
I love trying things, not only in web development and engineering management, but also in other areas like philosophy. Here on meiert.com I share some of my experiences and views. (I value you being critical, interpreting charitably, and giving feedback.)