Today we're gonna learn how to set up a static website using Amazon's S3 bucket.
This is the AWS management console. First, what we are going to do is create a
bucket and configure it to function like a website. So, you can either type in here
find your services, and type in S3 which is our scalable storage, or you could go
down to storage and choose S3 and then once you choose that it will be one of
your recently visited services. So, I already have a static website created
with my AWS account for an S3 bucket, but we're gonna learn to make
another one. So, you won't have anything, you will get a view where you don't have
any buckets and you're gonna choose to create a bucket. Here is the module for
creating a bucket it asks is for a bucket name, this is has to be unique. So
for example, if I type in static website and if I tried to create this someone
already has a static website so it has to be unique. So, play around with it as
you can tell from before I had static-website-joanneskiles so I'm going to
just do a static-website-joanneskile2 and you choose which region you want it
to host in I am going to default it on North Virginia region and you can choose
to copy settings from an existing bucket after naming your bucket click next. Now
you get to configure your options there's a bunch of different properties
that you can change you can have versioning on a bucket you can log access
requests and everything that's gone on within your bucket and you can turn on
cloud watch to monitor or request your buckets but this is an additional cost
so keep that in mind if you choose to turn on cloud watch and you're trying to
host a website and you want to stay in that
money bracket then you're gonna have to read the pricing so I'm not choosing any
of the properties I'm just gonna hit next and I'm on my permissions this tab
is over viewing the permissions for our bucket and by default
AWS selects block all public access but when we are creating a bucket and we
want it to become a website we need it to be accessible so at this point we can
uncheck block all public access and then let's say we acknowledge the current
setting for this bucket now if you don't do this and you skip it and you end up
letting it be default where it's all block all public access do not despair
you can change it within your bucket as well so we're gonna hit next we can
review all of our settings everything's there and then we choose create bucket
so let's go into our newly created bucket so we are not done yet with
making all the content on our bucket publicly available so what we need to do
is go to our permissions tab and choose a bucket policy and what you can do is
we can type in a bucket policy so I've written a policy here that makes all the
bucket content publicly available because this is going to be a static
website people are going to access it you want them to have permission to all
the items if that's not the case then you don't want to use this policy so if
you have something that you don't want people to be able to access that is
going to be on your bucket then do not do this step you will just need to
individually set whatever content you want to being publicly available so we
have this policy this is the version this is the statement it's basically
saying that the is your able to get all objects get all
bucket objects and they are able to see it and it's only on the resource that is
the static-website-joanneskiles2 this is the bucket name so I'm gonna copy
this and paste it and click Save and now obviously we get a warning because we
are letting this bucket have public access and by Amazon standards they do
not really want you to ever grant permission a public access it's just not
exactly that secure so make sure that you're aware that you're doing this all
content is now publicly available now also as you can see it's up taking a
little tag that says public so that we did it right
Yay! So, let's go back to our overview here and let's add a little test web
page I have a simple index.html file that just basically has one line
that says "This is a test, nothing else" and the title is called "Test" I have this
actually saved on my desktop so I'm going to upload this file onto my bucket
so I hit upload click add files or you could drag and drop index it's going to
upload it up it has our permissions but we already
have everything set to be public so just make sure we have our public access to
this object we're gonna do keep it at standard basically keep all this at
default for right now and we upload so here is our first file uploaded and if
you want to test your website you can click into your index dot HTML like I
did and it gives us our object - URL if you click this here is our website
a little bit better of a view going back I'm gonna open into a new tab there's
your website this is the URL to that index page so congratulations you've
just put up a very simple static website using Amazon's S3 buckets