Search code examples
amazon-web-servicesaws-lambdaurl-routingamazon-cloudfrontdevops

DevOps - CloudFront/Lambda route certain paths to certain servers


We are trying to leverage CloudFront or Lambda to add some redirecting logic.

Our goal:

  • If the URL contains /marketplace/ -> Go to our Google Cloud server
  • All other URL's -> Go to our AWS server

From what we read in several posts it seems to be possible. However, I'm new in this area and am struggling with the setup. Any reads, tips, tutorials, or keywords to look for would be appreciated.


Solution

  • First you need to create your Cloudfront distribution, the first origin you create will be for the wildcard (*) e.g. your AWS server.

    After you have created it, you can add other routes (such as that for your /marketplace/ endpoint) afterwards.

    If you click on the information icons next to each field, they do an ok job of explaining what to put into each field