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

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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인