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:
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?
You can use Amazon S3 to host a static website. On a static website, individual webpages include static content. They might also contain client-side scripts. By contrast, a dynamic website relies on server-side processing, including server-side scripts, such as PHP, JSP, or ASP.NET.
To enable static website hosting Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/ . In the Buckets list, choose the name of the bucket that you want to enable static website hosting for. Choose Properties. Under Static website hosting, choose Edit.
A blue/green deployment is a deployment strategy in which you create two separate, but identical environments. One environment (blue) is running the current application version and one environment (green) is running the new application version.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With