Hi, everyone, and welcome back.
Now, in the earlier video, we were discussing about the basics of the origin, access, identity and
the advantages that it offers.
Now, in today's video, we are going to set it up practically to understand the exact steps that are
involved.
Now, one of the first things that you will need is a S3 bucket.
Now, for today's demo, I have an S3 bucket that is created called Demo Cloud front of a bucket.
And in this bucket there are no files that are currently available.
So first, let's do one thing.
Let's go ahead and upload a specific file.
So I'll do an upload.
Sawyer will add a file called or a I, and this is a simple HTML file.
I'll click on upload.
Now again, I'll attach this file as part of the resource so that you can also try it out.
Or in case if you have an HTML file, you can upload that instead.
All right, so our HTML file is now available.
So the next step is to create a cloud front distribution.
And within here, we'll set the origin to our bucket, which is demo, cloud, front or bucket.
Now, as soon as you select the S three as the origin, you have the option of origin access within
your.
There are two options.
First one is the legal access identities.
So this is the original origin access identity that we use to use quite extensively.
However, the newer one is called as the origin access control settings.
So this is the one that we will be using as part of the newer approach.
Now within here you can go ahead and create a control setting.
So let's create a control setting.
We'll leave everything as default and I'll click on Create.
All right.
So our control setting is currently available.
Once this is done, let's go a bit down.
We'll leave everything as default.
In the default root object, I'll just say, Oh, I dot HTML and we'll go ahead and we'll create a distribution.
Now, as soon as the distribution is created here, we got a message stating that the S3 bucket policy
needs to be updated and it also gives you the option to copy the policy.
So let's copy this.
Now, before we add it, let's look into what this policy really means.
Now, within the local editor, let me just paste the policy.
So the overall policy is very simple.
What it does, it allows the cloud front service to perform a three get object operation on the specific
bucket.
So this is the bucket.
And there is one condition which states that not all the cloud distribution should be allowed, but
only the cloud run distribution which has this specific ID in this specific account.
So if you see the ID ends with 2qz, and if you look into our cloud distribution, again, it ends with
two Q, Z.
All right.
So this is what the policy does.
Now note that at this stage we are able to easily copy this specific policy statement from here.
However, A generally makes regular changes.
So in case if you do not see this, then I'll also add this specific policy.
After this video, all you'll have to edit is the name of the bucket, the account number here and the
distribution ID list.
Everything remains to be the same.
So once we got the policy, let's copy this within the three bucket will go to permissions.
Let's go a bit down.
We have the bucket policy here.
Let's click on edit.
I'll add the new policy.
We'll go ahead and we'll save the changes.
Great.
And that's the only thing that is required.
Now, if you go back to the cloud trend distribution, our distribution status is now enabled and we
are also getting the domain.
So let's copy this specific domain.
Let me add it within the browser and if everything is working, you should see a website.
So here you are getting congratulations.
Okay, works.
So this is the high level overview about the origin access, identity or the newer approach, which
is the Origin access control.
Now, again, one of the benefits that you will see is that the contents of the S3 bucket, you no longer
have to make it public.
It continues to remain private and this proves to be quite useful from security point of view as well.
So with this, we'll go ahead and conclude today's video.