How to Multiple websites on same S3 bucket using Cloudfornt and Lambda@edge?

0

I have use case were I need to host multiple websites in same s3 bucket. The content is seperated inside the S3 bucket via directories. Ex: S3:abc/app1 S3:abc/app2 It will be access via cloudfront URL The cloudfront URL should be able to fetch d7mb****.cloufront.net/app1 d7mb****.cloufront.net/app2

Mee
已提问 9 个月前834 查看次数
2 回答
0

Have you looked into this? https://dev.to/unfor19/multiple-static-sites-in-a-single-s3-bucket-served-by-cloudfront-3ako? That should give you a good view on how to host individual sites in different “folders” of a single bucket.

If instead looking into microfrontends, I wrote a series which ends up hosting an app shell and multiple frontends in a single CloudFront distribution with a single S3 bucket. Hope you enjoy it/is helpful: https://levelup.gitconnected.com/a-complete-aws-architecture-for-module-federated-micro-frontends-a0306ba466e3 and https://alatech.medium.com/lerna-module-federation-for-aws-micro-frontends-c26ec6610016

profile picture
专家
已回答 9 个月前
0

Hi, thanks for asking this question on re:Post!

You don't necessarily need a Lambda@Edge to rewrite URLs in this case. If the only missing thing is ability to point to multiple index.html files stored under different prefixes on S3 (such as app1, app2), you may use a CloudFront Function to add index.html to request URLs that don’t include a file name. Please let us know if this solves your issue, or provide us with more details about your use case!

AWS
Piotrek
已回答 9 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则