0

I have a static S3 site in bucket_old and will rebuild it route by route in S3 bucket_new using the strangler pattern.

  • URLs /home, /contact map to bucket_new

  • All other URLs map to bucket_old

What AWS infrastructure should be used to route some requests to bucket_old and others to bucket_new? Ideally to change which paths go where, I would only need to update/deploy a config.

Justin
  • 101
  • 4

1 Answers1

0

AWS CloudFront will let serve different paths from different origins. See this blog post. Copy for reference

  1. Open your web distribution from the CloudFront console.
  2. Choose the Origins view.
  3. Create one origin for your S3 bucket, and another origin for your load balancer. Note: If you're using a custom origin server or an S3 website endpoint, you must enter the origin's domain name into the Origin Domain Name field.
  4. From your distribution, choose the Behaviors view.
  5. Create a behavior that specifies a path pattern to route all static content requests to the S3 bucket. For example, you can set the "images/*.jpg" path pattern to route all requests for ".jpg" files in the images directory to the S3 bucket.
  6. Edit the Default (*) path pattern behavior and set its Origin as your load balancer.
Tim
  • 31,888
  • 7
  • 52
  • 78
  • Would this require labda@edge to keep the URLs from becoming CloudFront URLs? https://stackoverflow.com/questions/31567994/multiple-cloudfront-origins-with-behavior-path-redirection – Justin Dec 04 '20 at 18:07
  • I don't think so. Try it and see. – Tim Dec 06 '20 at 07:30