Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is A/B testing in AWS for static websites not possible using Cloudfront?

I've provisioned the following AWS resources to host a static website (via Cloudformation):

  • S3 bucket to store the website
  • Cloudfront distribution for CDN (for reduced latency)
  • Route 53 A record sets that directs traffic to the CDN

I have two completely different websites that I'd like to A/B test to see traffic behavior and conversions. Is it possible to configure A/B testing using the resources that I've configured?

This is what I've tried so far.

Bringing up the same Cloudformation stack for the second website doesn't work cause Cloudfront only allows a single distribution to have a particular CNAME. For example if my website is example.com, only one Cloudfront distribution can have that CNAME configured to it.

If I try to use the existing Cloudfront distribution there doesn't seem to be a way to split traffic to the two different websites hosted in different S3 buckets. Within the Cloudfront distribution I need to create a second origin and then a behavior. The behavior requires a path + precedence so all the traffic will get sent to one of the websites but not the other.

Is it not possible to configure A/B testing of static websites hosted in S3 with Cloudfront?

like image 424
n00b Avatar asked Jul 25 '17 13:07

n00b


1 Answers

You can use a Lambda@Edge function to manipulate the request and then serve a different page using CloudFront.

A/B Testing example:

http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-examples.html#lambda-examples-a-b-testing

like image 186
Antonio Avatar answered Oct 16 '22 17:10

Antonio