Hi, everyone, and welcome back.
Now into this video, we are going to discuss about how we can set multiple origins at cloud print level.
Now, one of the great benefits that cloud print provides is that depending upon the overall UI of the
request, the origin to which the request is sent to can also change.
For example, here you'll see that any time a user request for some kind of a HTML file or maybe you
can consider it to be some kind of a dynamic content.
For an example, the request would go to the EC2 instance.
However, whenever a user requests some kind of an image files like JPEG files or some kind of a static
content, then the request goes to the S3 bucket.
So this kind of a architecture you can implement using multiple set of origins.
Now let's go ahead and also have a quick demo before we understand it further.
For example, in this specific cloud distribution that I have, there are multiple origins that are
configured.
So if I open this up, let's go to the origins within.
You'll see that there are two origin.
One is the easy to instance and second one is the S3 bucket.
This is very similar to the diagram.
Now the question that comes is since there are two origins, to which origin will the cloud front send
a request to?
So this all depends on the behavior.
Now, in here I have two set of behavior.
One is related to images slash start or JPEG.
So any request that has this specific part, then the request goes to this origin.
If you look into the origin, it is the S3 bucket.
However, any request that does not have this path, there is a default of EC two instance over here.
So let's go ahead and quickly look into the working now for the S3 bucket that we have configured.
If you will see the path pattern is images slash start or JPEG.
Now within the bucket I have images and within here I have an image college shift jpeg.
Along with that I also have an easy to instance that is running.
Let's copy the IPV four of this instance and if I'll add it in the browser, it basically shows you
welcome to Engine X page.
Now this easy to instance does not have any images configured.
For example, if I'll say images shift or jpeg.
Immediately you're getting an engine error, primarily because the image file is not present here.
So to test things out, let's copy the URL of the cloud distribution.
So let's copy the domain name.
Within the URL.
Let's add this domain name.
If I press enter as expected, we are getting welcome to the next page.
However, as soon as we type images shift or JPEG, then this specific request will go to the S3 bucket.
So let's verify and as soon as we did you got the image back.
Now.
In fact, you can also check through the ClA.
So if we look into the headers associated with this, we are getting the welcome to Engine ICS page.
This is something that we have already seen.
And in the header you see that the server is engine X, so this is the engine x web server that is running
on the EC two instance.
Let's clear the screen.
This time we'll send the request of images to the cloud for distribution.
And from the header we can now see that the server is no longer engine X, but it is the Amazon S3.
Great.
So I hope with this at a high level overview, you understood the multiple origin configuration.
Now the overall steps are very simple.
The first primary step is you have to configure multiple set of origins within the cloud front distribution
and then you can go ahead and set various path patterns depending upon the use case.
For example, if you have static contents like images in SX three, you can specify the path pattern
here and you can specify the overall origin.
So that's a very high level overview and with this will conclude today's video.