- Articles

Learn how to host your website on the cheap with Amazon’s AWS | UNCUBED


my name is Jacob Robin and I’m the CTO
of Uncubed.com with provides you with the best jobs and opportunities and
innovative companies today I’m going to show you how you can put a small website
online quickly and easily and for very low cost by low-cost I mean as low as 2
or 3 cents a month the trick is using Amazon Web Services which provides
wholesale pricing for online computer resources in the cloud its equivalent of
shopping at Sam’s Club or Costco instead of your local grocery store if that
sounds good follow along and I’ll show you how you can put your next website
online in a very cost efficient manner first of all what is Amazon Web Services
Amazon Web Services or AWS for short is a collection of cloud computing services
offered by Amazon it’s used by hundreds of companies from startups all the way
up to the fortune 500 and it consists of dozens of different offerings the one
that we’re interested in is their file storage service it’s called s3 which
stands for simple storage service I’m going to talk about how you can use s3
to host a static website that includes HTML CSS JavaScript any of the files
that you might need to make a website the static part just means that the
files will stay the same until you upload a new version of them you can’t
do programming on the server to customize them for different users or
use cases however even with the static website you can have JavaScript that
allows you to do programming that happens in the user’s browser when they
view the site so now let’s talk about the cost of hosting a static website in
Amazon s3 all AWS services use volume based pricing so you only pay for what
you use also I’m going to assume that you’re using s3 in the United States the
pricing is different outside of the US and the prices may be different by the
time you view this video so be sure to check the AWS pricing page before you go
ahead and do this for s3 the primary charge to be aware of is bandwidth they
do also charge for file storage and the total number of requests however those
charges will be quite small in total for example files
and s3 costs 2.3 cents per gigabyte so for example if you have a website that
consists of 10 megabytes of files that’s 1% of a gigabyte so at 2.3 cents that’s
going to cost you to one hundredths of a cent per month which they will round up
to one cent per month same with the per transaction costs so you’re looking at a
baseline of two cents a month and then the bandwidth is going to come on top of
that let’s move on to bandwidth bandwidth is the cost of transferring
files from s3 out to the Internet and that’s incurred every time somebody
views one of the pages on your website all the files that make up that page you
have to pay bandwidth on them going out to the Internet so for example if you
have a website where a page is five megabytes of files you know the HTML the
CSS the images then every time there’s a page view for that page you’re going to
pay the bandwidth costs for five megabytes currently the bandwidth costs
for s3 are free for the first gigabyte then nine cents for every gigabyte
thereafter at that rate I’ve done the calculation and it looks like you can
have up to 230 page views each month for just one cent in bandwidth so you’re
really looking at a starting point of 230 page views and three cents a month
but what happens if it goes a little higher than that let’s say you get up to
500 page views then you’re looking at 14 cents a month in bandwidth costs and the
two cents on top of that so 500 page views is going to be 16 cents if we get
up to five thousand page views you’re looking at an all-in cost of two dollars
and 18 cents a month here’s where you need to pay attention to AWS is
volume-based pricing because if your site suddenly got extremely popular it
could end up costing you a lot of money in bandwidth to get back to our
hypothetical five megabyte web page example if it was viewed a hundred
thousand times that would cost you about forty five dollars in bandwidth costs if
you happen to have your site you viewed a million times you’re getting up to
four hundred fifty dollars in bandwidth which is kind of a lot
so if you think your site is going to hit millions of views and you don’t want
to pay for the bandwidth that that will incur you’re better off using an
ad-supported social media site like Facebook or YouTube or Instagram but
generally if you’re making a small website for a portfolio or just to try
out a business idea you’re going to be getting hundreds or thousands of views
maybe cracking 10,000 but that’s probably about it in that case Amazon’s
volume based pricing is really the key to saving a lot of money in web hosting
so to get back to our five megabyte web page example if that page is viewed
2,500 times a month you’re paying one dollar and two cents all in and hosting
it on s3 which is a great deal I created a spreadsheet in Google Docs
to come up with these bandwidth cost estimates it’s listed next to this video
on the uncute website at Ncube comm you can go there look up this video and then
you can see the calculations for yourself and figure out how it applies
to you so now we are going to set up a static
website in Amazon s3 step one is to get an Amazon Web Services account you go to
aws.amazon.com and you click to create an AWS account button and sign up here
if you already have a regular Amazon account for shopping online you can use
that login right here and you’re already set once you login to the AWS console
find s3 in the list of available services here it is under storage next
we need to create a bucket to store files for our website in s3 files are
called objects and all s3 objects must be inside a bucket you can have multiple
buckets in your account you can see here I have some for a website I already made
and each bucket could be its own website or you could just use it to store some
files so we’ll click create bucket here now the name of your bucket has to be a
name that no one else on AWS has used yet that’s because it will be part of
the default URL by which you can access the files also if you want to put your
website at a custom domain and you do that’s the whole point here then the
name of your bucket needs to be exactly the same as the name of that domain so
in this example I’m going to make a website called WWE boo cult anonymous
com so I’m going to create a bucket called wwq Bacall’s anonymous comm and
that needs to include the periods the www at the front of this domain is
called the subdomain and using a subdomain makes it easier to set this up
so I’m going to show you how to do it with that method you can make it without
a subdomain just doing in my kids cubicles anonymous comm but to do it
that way you have to use the AWS domain name manager service it’s called route
53 and it’ll cost an extra 50 cents a month for each domain you have in there
it’s a little quicker and easier to do it with the subdomain so I’m going to
show you that method here the estrin console is also asking for region to put
this bucket in the standard to go with here is us East
North Virginia note that a few of the regions have higher prices so check the
s3 pricing page when you do this now we need to go to the next page this UI is
actually not showing me the next button so I’m going to zoom out here a little
bit so I can see that when I hit next it shows me this set properties page you
don’t actually need any of these properties to set up a static website so
I’m just going to continue along here however this permissions page is a
gotcha if you don’t set the public permissions to allow read access for
everyone then hope people won’t be able to view the contents of your website
note that the screen doesn’t appear on older versions of the AWS console
website for those you just need to set read permissions when you upload the
files which I’ll be showing you shortly either way just note that you’re looking
for permissions and you want to make sure that everyone has read permissions
for the objects that’s also sometimes called view permissions this other
column object permissions is about the permissions to view the permissions
themselves you can really ignore that so that’s all we have to do with the
permissions let’s go onto the next page here it’s giving me a review and now I’m
ready to go ahead and create my bucket once you’ve created the bucket you have
to enable it for static website hosting which you do by opening it up and going
into the properties tab this might look a little different once again if your
version of the AWS console website is different but you’re looking for static
website hosting and you want to turn that on the one thing you have to set
here is the index the name of the index document that’s the file that will be
the website home page you can use any file you want it’s a convention to call
it index.html as they were suggesting here so I like to just do it that way
and we hit save and it’s all enabled as it shows here now that our web bar
bucket is set up for static website hosting we want to upload the files a.k
objects to our website into it I’ve put together a simple website locally with
an HTML file some images and CSS if you’re familiar with an FTP client some
of them support uploading files to s3 for example cute FTP in cyberduck both
support this but for this simple file I’ve just put the website files into a
directory on my desktop and I’m going to upload them using the upload button
right here so I click upload I’m going to click add files I’m going to here’s
the website files directory I’m just going to select all of these files and
go ahead and add them here click the next button once again this is the
permissions gotcha so you want to click public permissions we have to do this
again and for everyone on the objects we want to allow them to read this is going
to be the same even if you’re using the previous version of the AWS console web
page we hit next and all this stuff is fine so I’m just going to go ahead and
upload those and I should see them start to percolate into here as my upload goes
great so now everything is uploaded now that our files are uploaded we can test
that the website is working on the default URL the Amazon s3 provides so to
do that we go back to where we enabled static website hosting in the properties
tab over here at static website hosting and you’ll see this URL is the default
URL that Esther gives us so I’ll copy that and I’d like to use an
incognito window to simulate a logged out visitor to the site that way I can
check that the read permissions were set correctly so I go ahead and I paste that
URL in there and we can see that the site loads up fine at the default URL
note that if the images didn’t load here you probably didn’t use relative paths
for your image files in your HTML okay now that the site is functioning on the
Amazon side I want to point my domain name at it to do that you need to have
purchased a domain name using a domain name registration service like Namecheap
or GoDaddy I’m here in GoDaddy DNS management panel
where I’ve bought the domain name cubicles anonymous comm and what I want
to do is make the subdomain WW and alias for the s3 domain of my bucket in DNS
terminology an alias is a cname so I want to add one of those records here
I’m going to click the Add button and I’m going to select the type cname the
host is actually the subdomain itself which in this case is just WWE that I
wanted to point to is that name that I got from Amazon over here so actually I
just want to make sure I just get the domain part not the HTTP I’ll paste that
in here let me just make sure it didn’t get the HTTP at the front yep looks
great this TTL stands for time to live I’m
going to set that as short as possible just in case I change my mind and want
to change this later so I hit save and it’s going to go ahead and add that
record note that it can take a little while for these changes to percolate so
I’m just going to wait for a bit here and say maybe 20-30 minutes later I
should be able to go to wwt become synonymous calm and voila it pulls up my
static website hosted on Amazon s3 my name is jacob robbins and i just showed
you how to set up a small website quickly easily and most importantly for
a very low cost using Amazon s3 to get more digital tips
go on cube comm and sign up for our
newsletter on cube daily

About Bill McCormick

Read All Posts By Bill McCormick

Leave a Reply

Your email address will not be published. Required fields are marked *