AWS Bites Podcast

80. Can you do private static websites on AWS?

In this episode of the AWS Bites podcast, we discuss the challenges of hosting private static websites on AWS.

We explore why it's important to host internal corporate applications and line of business applications only for internal consumption, and the requirements for doing so.

We also evaluate different options for hosting private static websites, including S3 with CloudFront, containers on ECS/Fargate with ALB, API Gateway, and AppRunner.

Finally, we summarize the pros and cons of each option and provide a rating for each.

If you're looking to host a private static website on AWS, this episode is a must-listen!

AWS Bites is sponsored by fourTheorem, an AWS Consulting Partner offering training, cloud migration, and modern application architecture.

In this episode, we mentioned the following resources:

Let's talk!

Do you agree with our opinions? Do you have interesting AWS questions you'd like us to chat about? Leave a comment on YouTube or connect with us on:

00:01:50

So if they want to expose some kind of functionalities, some kind of interactive website they can do that using a single page application and this single page application will be totally static. It's just HTML, CSS and JavaScript and it will be relying on some internal APIs for more dynamic functionality. And one example for instance could be, I don't know, you can imagine a bank that internal needs to have a way to browse, I don't know, mortgage application maybe and they can do all of that using an SPA and that SPA can call internal APIs and they can make it available only for internal consumption. Now again this just emphasizes how it is very common for web application to have a static part and a dynamic part. So we are trying to figure out how do we host that static part in the most efficient way or in the simplest way and the idea is that it's going to be only files, specifically HTML, JS, CSS, maybe some images, maybe some other assets like JSON, JSON, whatever and we need to have an easy way to serve those assets using HTTP. And for public websites, I know you are probably already thinking this is very easy, you will expect to be able to do that in like minutes just taking a repository from GitHub and deploying from there and if you have used Netlify or Vercel, these are the kind of experience you will get and we actually have spoken about that in a dedicated episode, check it out, episode 3, link is in the show notes if you are curious. How does it get difficult if you want to do it for private websites? What are the requirements there I guess is the question.

00:12:42

But what it looks like for a private alternative, can we do that? And until very recently, you couldn't really do private containers using AppRunner. But this has just changed because now you can create private endpoints in AppRunner, which are only accessible from a specific VPC and uses the VPC interface endpoints feature. So we are going to have a link in the show notes if you want to deep dive on this feature. But this is what is kind of making us reconsider AppRunner for this particular use case. And we could get this up and running by following a few steps. So definitely we need to define the container image. So what I could think is the simplest way to serve static assets is to just spin up an NGINX container. You make sure to bundle all your static assets in the NGINX HTTP folder. And then that container should be a good enough starting point for serving those static assets on the web. Now we need to, the way that you expose this stuff to AppRunner, again, is either to a repository, for instance, on GitHub, or through an ECR registry. So you can decide whether you want to publish stuff directly to a registry or keep a repository and then AppRunner will abstract the publishing process for you. You also need to create a VPC endpoint, interface endpoint, and something that is called ingress connection. That is what is used to link that endpoint to the AppRunner service. Finally, you need to set up a custom domain. And that is where things get a little bit hairy. And because that forces you to use a public DNS record. At least it doesn't support yet private hosted zones, but there is an open issue on GitHub. So hopefully that's something that is going to change soon enough in the future. So I think that's quite a reasonable option, but is it what we would recommend today or do we have a different final recommendation?

00:17:24

Then we have API Gateway, which could be used with Lambda to fetch from S3. It doesn't need to have a multi-xid setup and load balancers, but then it's limited to 10 megabytes, which could be a very strict requirement, maybe if you're serving big files, I don't know, maybe you have big images or other kind of big enough payloads. Also doing private custom domains is not supported yet, so that's another big issue. Finally, we have AppRunner, which is an interesting solution. It is probably something that we will need to revisit more in the future. It might become one of the best solutions if they enable certain features. As of today, it's simple enough to set up, it's multi-xid, it can give you private endpoints, but then you still are running public DNS records, so that's something that some companies might not be entirely happy with, and they might just disregard the solution because of that. Hopefully, that issue will be eventually closed and we will have that support, which might make AppRunner one of the best options out there for AWS. So that's everything we have for today, and again, if you think that we missed any idea that you maybe have solved this problem in a different way and you want to share your approach, we'd love to hear that. I think we spent significant amount of time thinking about this problem. For sure, we are missing some option there. I'm sure there are many other combinations of AWS services that you can use to achieve something like this, so if you know any one of them, please share it with us. We'd love to hear from you. Thank you very much, and we'll see you in the next episode.

Help us to make this transcription better! If you find an error, please submit a PR with your corrections.