- So now let's take a look at another demo
of creating a bucket policy
to make a bucket publicly readable.
So here we are back at the AWS console.
I'm in the S3 service with all of my buckets listed.
I'm going to click through
to the bucket that we've created for these demos.
You can see that we have our AWS live lessons bucket.
We have our mobile device jpg object that we've uploaded
and if I click on that,
and take a look at this link here,
we'll see that it comes up as access denied.
That's because by default S3 is secure by default.
You have explicitly grant permission
for someone to be able to read objects from that bucket.
And so we could modify the permissions
of that particular object using ACLs,
but if we wanna just make a blanket statement
and say that everything in this particular bucket
is publicly readable,
then we would do that with a bucket policy.
So I'm going to go in here to the bucket itself,
scroll down here to the permissions of that bucket
and I'm going to add a bucket policy.
Now I've already prepared one for this.
I'm going to paste that in
and again this is just like the policies we've seen.
We have a version, we have our collection of statements.
In this particular case we only have one statement,
the asterisk there, the wildcard says
anyone in the world can download an object
from anywhere within this particular bucket.
So I'm going to go ahead and save that.
Now that it's saved I wanna make sure
that I save this here again.
Come over here and when we refresh this,
we should be able to see that image.
And there we go.
Now we're able to see that image.
This is a really great example too
of using S3 for things like static assets for websites.
If you wanted to host all of your imagery,
your product portfolio, CSS, JavaScript, fonts,
whatever it is,
S3 is a perfect place to store static assets.
That way you can leverage the high availability
and fault-tolerance and performance of S3,
have your users download these objects directly
rather than having them get them from your web server.
You can reduce the load on your backend services
by just pushing that load off to S3.
So that is a bucket policy being applied to a bucket
in Amazon Simple Storage Service.