4

For example, a cloudfront distribution has the following CNAMEs associated with it

photo-cdn.example.com
video-cdn.example.com
music-cdn.example.com

And it has the following origins associated with it

originA: photo.example.com/photocontents
originB: video.example.com/videocontents
originC: music.example.com/musiccontents

I would like to be able to GET the following content files via the Cloudfront distribution as mapped below:

photo-cdn.example.com/photo.jpg => originA/photo.jpg
photo-cdn.example.com/image.png => originA/image.png

video-cdn.example.com/video.mpg => originB/video.mpg
video-cdn.example.com/movie.avi => originB/poster.jpg

music-cdn.example.com/music.mp3 => originC/music.mp3
music-cdn.example.com/itune.wav => originC/albumart.png

What should be the specific path patterns that i need to use to achieve this behavior?

Will the path pattern evaluation happen only on the SUFFIX of the distribution domain path (after music-cdn.example.com/)?

Or will the path pattern evaluation INCLUDE the distribution domain path (include music-cdn.example.com).

1 Answer 1

6

As long as you don't have overlapping file types you can use masks like /*.jpg, /*.png, /*.mpg etc.

But it won't work e.g. if you need to fetch .jpg album art from your music-cdn domain.

In this case you might need to split this into 3 different distributions, each having a single CNAME

EDIT: read the comments below for further clarification on which portions of the CNAME are actually evaluated by the path pattern evaluation

2
  • so you mean, the path pattern evaluation happens only over the suffix of the distribution domain path (after music-cdn.example.com/) and the path pattern evaluation does not include the distribution domain path itself (include music-cdn.example.com/) ?
    – Rakib
    Apr 8, 2015 at 6:00
  • 2
    Yes, exactly. Take a look at the description here: docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/…
    – Alex Z
    Apr 8, 2015 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.