Sarah Ganci
Sarah Ganci

Reputation: 269

Can an application load balancer route to s3 to host a static website?

Is it possible for an application load balancer to route to an s3 bucket to host a static website? The same alb would also route to apigateway via a vpc endpoint.

Upvotes: 3

Views: 3292

Answers (2)

Ameba Brain
Ameba Brain

Reputation: 343

It's possible with vpc 3s interface endpoint.

https://aws.amazon.com/blogs/networking-and-content-delivery/hosting-internal-https-static-websites-with-alb-s3-and-privatelink/

Major problem with this approach through is that interface endpoint uses s3 REST API. Which means that you couldn't specify fallback to your index.html in case of 404 errors. This means that if you host your SPA code and user enter in a browser host:port/some/logical/path/within/your/app you will get XML 403 or 404 error instead of served index.html.

And this problem makes this feature almost non-usable, if you have a requirement to allow bootstarp of your apps from deep links

Upvotes: 4

Christoph Fischer
Christoph Fischer

Reputation: 105

As far as I know, this isn't possible.

Take a look at Cloudfront instead: https://docs.aws.amazon.com/cloudfront/index.html

Use your S3 bucket and the ALB as origins in your setup.

Upvotes: 3

Related Questions