AntMor
AntMor

Reputation: 447

High Availability deployments to a Static Website hosted in AWS S3

At AWS, in the classical architecture of Route53 (domain management) -> CloudFront (HTTPS management) -> S3 (storing website).

I wonder how to do High Availability deployments. I.e., when deploying a new version of your website, some files can have dangling references for a tiny bit of time.

Is it possible to cache the previous site in CloudFront and then evict the caches? Is there any other solution? Thanks!

Upvotes: 1

Views: 343

Answers (2)

Marcin
Marcin

Reputation: 238169

Instead of invalidating entire cache, the CloudFront documentation recommends two alternative ways:

Invalidate the file from edge caches. The next time a viewer requests the file, CloudFront returns to the origin to fetch the latest version of the file

Using this way you invalidate the individual files with those dangling references.

Use file versioning to serve a different version of the file that has a different name. For more information, see Updating Existing Files Using Versioned File Names.

Here your website would refer to old or new version of those sites with dangling references. W

Upvotes: 1

Chris Williams
Chris Williams

Reputation: 35188

You could have it set to trigger a Lambda function once you've deployed that would purge the cache on CloudFront. Depending on how you deploy to S3 this could be automated by that process at the end.

Upvotes: 1

Related Questions