S3 static website /w bluegreen deployment
Asked Answered
B

3

7

I'm having difficulty providing a bluegreen for my s3 static website. I publish a version of the website in a given bucket and it is exposed at:

  • a Cloudfront distribution
  • then on a Route 53
  • and yet another CDN (corporate, which resolves the DNS) to reach the internet.

I've trying some "compute" solutions, like ALB, but I'm not successful.

The main issue of my difficulty is the long DNS replication time when I update CloudFront with a new address, making it difficult to rollback a future version to the old one (considering using different buckets for this publication).

Has anyone been through this or have any idea how to solve this?

Broadcasting answered 2/2, 2020 at 20:27 Comment(0)
W
6

AWS recommends that you create different CloudFront distributions for each blue/green variant, each with its own DNS.

From the Hosting Static Websites on AWS prescriptive guidance:

Different CloudFront distributions can point to the same Amazon S3 bucket so there is no need to have multiple S3 buckets. Each variation [A/B or blue/green] would store its assets under different folders in the same S3 bucket. Configure the CloudFront behaviors to point to the respective Amazon S3 folders for each A/B or blue/green variation.

The other key part of this strategy is an Amazon Route 53 feature called weighted routing. Weighted routing allows you to associate multiple resources with a single DNS name and dynamically resolve DNS based on their relative assigned weights. So if you want to split your traffic 70/30 for an A/B test, set the relative weights to be 70 and 30. For blue/green deployments, an automation script can call the Amazon Route 53 API to gradually shift the relative weights from blue to green after automated tests validate that the green version is healthy.

Wingding answered 2/2, 2020 at 21:32 Comment(1)
jarmod, thanks to answer my question. In this case, if I need to do a rollback to the green environment, It'll be gradually, isn't it? It'll take the DNS replication time? In this momment, my application cannot "be in green" all this time...Broadcasting
S
1

Hosting Static Websites on AWS - It's 2016 year whitepaper. It relies on non-working examples that don't work. You can't just setup two cloudfront distributions to serve the same CNAME for dns switching.

Another way is to do green/blue logic in lambda edge.

Serpent answered 2/3, 2021 at 7:12 Comment(0)
O
1

You can do blue/green or gradual deployment with a single Cloudfront distribution, 2 S3 buckets and Lambda@Edge. You can find a ready-to-use cloudformation template that does this here.

Otti answered 30/5, 2021 at 6:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.