Pete Dermott
Pete Dermott

Reputation: 723

Updating AWS Cloudfront to use static website hosting

I'm currently using AWS Cloudfront to serve assets for a companies website under the subdomain content.companyname.com. The current distribution points to companyname.s3.amazonaws.com.

With this setup we lack some of the static website hosting features such as a custom index.html page and a error page. I understand from this answer that I need to point instead to http://companyname.s3-website-eu-west-1.amazonaws.com to get this to work.

My question is, can I just update the Origin without having to create a new Cloudfront distribution? Or is it better to create a new Cloudfront distribution then change the DNS and associate our custom CNAME with it?

We are ideally looking to have zero downtime if possible.

Upvotes: 0

Views: 320

Answers (1)

Michael - sqlbot
Michael - sqlbot

Reputation: 179114

Create a second Origin on the CloudFront distribution, pointing to the new endpoint.

Then you can update each Cache Behavior and select the new origin from the drop-down, and save changes.

If your bucket is correctly configured, this change will take effect over the course of a few minutes, without any downtime.

Upvotes: 0

Related Questions