Can a static site be deployed to multiple regions in S3 and use a load balancer to direct the user to the nearest region?
I didn't try anything
CodePudding user response:
- setup S3 Cross-Region replication from your primary bucket to one or more buckets in other Regions: https://docs.aws.amazon.com/AmazonS3/latest/userguide/replication.html
- You can configure a whole bucket to replicate, or just a subset of objects to replicate. Make sure you configure it so all your site assets are replicated
- If you would rather be able to upload/change assets in any bucket (not just a designated primary), you can set-up bi-directional replication
- Setup CloudFront to use S3 as an origin [whitepaper], [hands-on lab]
- Load balancing is not natively supported by CloudFront, but your options are
- Failover routing, where it will use onw bucket to serve requests, but if that request fails, it will use the other bucket (origin)
- Routing requests based on behaviors
Alternatively, instead of step 3, you may be able to use Multi-Region Access Points in Amazon S3. This provides a single access point that will route you to the bucket with the lowest latency.
- It looks like you can setup the multi-Region access point as a custom distribution origin in CloudFront. So this may suit your use case