In this video, we are going to continue to our hands on, which is a static website hosting on Amazon
S3 using a PlayStation console.
As you remember that in the last video, we have finished the first three step and now we are going
to continue with the rest of the steps, four, five and six.
So the first step the first step is the ADD the bucket policy that makes bucket content publicly available.
So if you open the measurement console, you can see in here in the last video, we have removed the
public access restriction and now it is available for the public access, but it will be configured
these settings if you come this link and refresh the page again, it is turning 403 forbidden and access
tonight because we have to set required bucket policy to access our bucket content from the public in
locations for that purpose, open our pseudocode and I have created a separate folder and as you can
see that now we are in this step four, five and six steps.
So we will follow these configurations.
So basically in the step four, we will add bucket policy that makes bucket content publicly available.
So in order to do that, I'm going to go to buckets, permission and bucket policy.
So if you open the our application mission console, if you go to the bucket and again, permission.
So if you scroll down, you can see the bucket policy.
The bucket policy, we should write a JSON format and it provides to access the objects stored into
the bucket.
And bucket policies don't apply to object owned by other accounts.
So that means we should provide the bucket policy in order to give access to objects which included
the bucket.
So how we can write the bucket policy?
If you come here and click the edit button, we can see that you can show the policy examples or policy
generator in here.
For example, let's see one by one policy examples.
In this document you can scroll on and see some example policies.
For example, in here we will give this kind of permission and this is an example bucket policy that
is basically allowing for the get object and get object version for this resource type.
So we will follow the same steps and we will create our bucket policy in order to give get object access
from the public locations.
Okay, let's get started.
So in order to do that, please open the pseudocode.
And in this pseudocode I'm going to create a bucket policy JSON.
So here you can find that I have copy and paste from the documentation and only change for the seed
is the name and ID you can give anything in here.
And basically we are allowing all principles for the action.
S3 get object.
The resource of the are a run of the S3 bucket.
So here is important.
We should replace the bucket name as we create in this previous video.
For that purpose, please go to our bucket and get the bucket name.
You can see that we have bucket Erin and here is the bucket name in here.
You can copy from here.
And also you can go to buckets and go to bucket list, come here and copy it from here.
So this is the our bucket name.
So if you come back to our widget to do a quote, I'm going to replace only in here the bucket name.
Please make sure that you have copy and paste bucket name in here.
And the previous part should be the earn a S3 and these double quotes.
Please don't forget to add Slash and the start character which is which is indicating the object that
we are going to give access requirement for the object into S3 buckets.
Okay.
After that, please save this JSON file, copy this JSON file and go back to our policy statement here.
You can see the our bucket policy statement under the bucket permissions.
And if you scroll down and click the edit bucket policies, you can copy and paste in here.
Yes.
So here you can see the bucket policy, make sure that the first character should be the color bracket,
otherwise it won't be correct and the whole structure will be the same.
And the name of the run of the resource should be the our bucket name and should include slash start.
So if you scroll down, you can now click the save change.
If you click the save change, yes, this time I have get successfully edit the bucket policy and if
you scroll down you can see the bucket policy under the bucket permission tab and here we give the required
l0 and access to get object of our bucket.
So now we have finished the fourth step if you come back to our command text.
We have successful at the bucket position and create a bucket policy.
Now we are going to configure an index documentation, index, HTML documentation because because we
will perform static website hosting and our static document will be the index HTML that we are going
to represent from the our browser Chrome browser.
That's why I have created an index HTML file into our lecture folder.
And here you can see the very basic HTML file that we are going to hosting on Amazon S3 so you can find
the index HTML under the lecture folder.
I'm going to upload these index HTML into our bucket as object.
Okay, let's get started.
So go back to our measurement console and go to buckets and come back to our newly created bucket.
And this time I'm going to upload an object which will be the eight files, which will be the index
JS file index, HTML file that is going to be hosting as a static website into our S3 bucket.
I have added the index HTML and if you click the upload button now we are ready to access these index
HTML from the publicly accessed any browser.
So as you can see that we have continue our hands on up.
In the next video we are going to test our website hosting on the Amazon S3 within working from the
Chrome browser.