Survival reboot with AWS CloudFront

We all know that CloudFlare has a feature where, if your server is offline, it will start serving the cached version of your website - was there something terribly wrong, or are you doing a simple restart.

I was looking for clear heights and low, on how to do the same with CloudFront, but I just can't possibly not dig any resource on this.

Do you have pointers?

+5
source share
4 answers

It is best to put a load balancer (for example, using the Elastic Load Balancer ) in front of your server and deploy another server that replicates your existing site. You can also use Elastic IP Address to redirect traffic if any server is down.

Then you can use a shared MySQL server (for example, AWS RDS in the Multi-AZ configuration for additional redundancy), as well as GlusterFS, to keep the root directory of the site on both web servers in sync. DigitalOcean has a guide for this here: https://www.digitalocean.com/community/tutorials/automating-the-deployment-of-a-scalable-wordpress-site

I would highly recommend CloudFlare over AWS CloudFront, there are many other advantages of CloudFlare (for example, CloudFlare has HTTP2 support, where CloudFront does not support ).

+4
source

CloudFront will retrieve your assets from your source, store them at the extreme location on your first view request, and return the cached version to subsequent viewer requests.

After the expiration of the object at the border location, CloudFront will again contact the source to determine if the cache has the latest version of the object and, if not, to obtain the latest version. If your origin server is unavailable at this time, CloudFront will return the [deprecated] cached version of the object to the viewer.

Please see CloudFront documentation here - http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/HTTPStatusCodes.html#HTTPStatusCodes-no-custom-error-pages .

+3
source

Name your traffic on CloudFront all the time . CloudFront will retrieve content from your server as needed (i.e. if CloudFront already has a fairly fresh cached copy of the page or other resource, it will serve this cached copy). If your server is down due to a reboot or something went wrong and CloudFront has a cached copy of your page, CloudFront will serve the cached copy no matter how fresh it is.

If you need to make sure that a certain resource is in the CloudFront cache before your server goes down, simply click on this page using a web browser. This will force CloudFront to serve the page from the cache or pull it from your source server; in any case, the net result is that the page is cached in CloudFront.

+3
source

Cloudfront simply caches static content. This is nothing but a CDN.

If your server needs a reboot, I assume this is a standard web stack. If so, you should use ELB with several machines. You can probably get away with micro-instances if you think cloud computing does most of the work.

If you have a static website, just use S3. It does not reboot, and you can easily CDN through the cloud interface. No need ELB

+2
source

Source: https://habr.com/ru/post/1238920/


All Articles