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
preguntada hace 9 meses834 visualizaciones
2 Respuestas
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
EXPERTO
respondido hace 9 meses
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
respondido hace 9 meses

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas