Rakib
Rakib

Reputation: 13085

cloudfront path pattern example for multiple subdomain origins

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).

Upvotes: 4

Views: 10176

Answers (1)

Alex Z
Alex Z

Reputation: 1867

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

Upvotes: 6

Related Questions