Serverless Website in AWS and its pricing

Dilip Kola
Tensult Blogs
Published in
4 min readDec 17, 2017

This Blog has moved from Medium to blogs.tensult.com. All the latest content will be available there. Subscribe to our newsletter to stay updated.

This blog speaks about how we hosted our website for almost nothing on AWS. We’ve talked about the architecture on our other blogs here and here, and this post will focus on the cost aspects of this setup.

I say almost nothing as there is definitely some cost involved in the initial phase and it is going to cost you money after the end of the free trial period of 1 year. However, taking a serverless approach as we have, it is cheaper than running the smallest available server– a t2.nano on a no-upfront RI, which works out to about $53.568/year without considering the Route53 and other costs. The icing on the cake? You don’t have to worry about constantly backing up your server and patching it to defend against the latest vulnerability out there.

Below is the breakup of the costs involved in the first year and the costs after that:

Year 1: $13

Subsequent Years: $51.72 per year

These estimates have been arrived at as per the below traffic estimates and assumptions.

Year 1

Opex in the first 12 months for Static/Dynamic Site:

Buying a domain: Starts with $12 in Amazon but can go up depending on what top level domain you want to purchase.

There is no cost associated with the opex in the first year as AWS is quite generous with its free tier.

Caveats: You need to keep utilization of the resources within the AWS free tier.

S3 storage : 5GB of standard storage, 20,000 Get Requests, 2,000 Put Requests, 15GB of data transfer out every month. A website needs only a few MB to few 100 MBs. So we are unlikely to cross this.

CloudFront : 50 GB Data Transfer Out and 2,000,000 HTTP and HTTPS Requests each month for one year. Should be pretty good for a basic website.

ACM : This service is free.

Route 53 : $0.5 for the hosted zone. Queries to Alias records that are mapped to Elastic Load Balancers, Amazon CloudFront distributions, AWS Elastic Beanstalk environments, and Amazon S3 website buckets are free. As we are mapping the CNAME of the Cloudfront in the R53, the queries should be free. Even if you add other records and get hits on them, it is charged at just $0.40 per million queries.

DynamoDB : 25 GB of Storage, 25 Units of Read Capacity and 25 Units of Write Capacity — enough to handle up to 200M requests per month. We don’t expect to exceed this limit

API Gateway : 1 Million API Calls per month. Enough for the website needs.

Lambda : 1,000,000 free requests and 3.2 million seconds of compute per month free. More than what a simple website can consume.

Total opex cost in the first year: If your usage stays within the free tier — $0.6 (Only for R53) + $12 for domain purchase = $12.6 ~ $13

Opex after 1 year (in Mumbai region):

S3 storage : Let us consider this a bit on the higher side. About 500 MB, Storage — $0.0125,

Hits to S3 will be minimal as we are using CloudFront. Let’s put it at about 10,000 requests. — $0.004 per 10,000 requests

CloudFront : Let us assume the data transfer out to be 10GB per month : $1.70

Request Pricing for All HTTP Methods. About 50,000 http requests and 50,000 https requests : $0.045+ $0.06 = $0.105 ie about 10cents

Domain renewal : This will continue to be the same price that you paid earlier. If you have paid $12, then you will have to pay $12 again at the end of the year to keep the domain.

Route53 charges : The Hosted zone will be 50 cents. The queries to the Cloudfront CNAME are free. So, you should not be charged for these which should contribute higher number of your queries. For all other queries, you will get charged $.04 per million queries.

API Gateway(Singapore): $4.25 per million API calls received, plus the cost of data transfer out, in gigabytes.

Even if you take a pretty good number of 100k API calls+data transfer out, you will get charged about 60 cents.

DynamoDB and Lamdba are part of non expiring offers. ie These free tier offers do not automatically expire at the end of your 12 month AWS Free Tier term and are available to all AWS customers.

DynamoDB : 25 GB of Storage, 25 Units of Read Capacity and 25 Units of Write Capacity — enough to handle up to 200M requests per month. Dont think we will exceed this.

Lambda : 1,000,000 free requests and 3.2 million seconds of compute per month free. More than what a simple website can consume.

Total cost per month = $0.0165(s3) + $1.8 (Cloudfront) + $0.9 (R53 queries and hosted zone) + 0.6 API G/W = $3.31/month

Total cost per year = $12(Domain Renewal) + (3.31x12) = $51.72 per year.

Effective cost per month = $4.31 per month

Do note that the domain purchase and renewal is the biggest cost factor in the above equation. You will pay this money whether you use Amazon or godaddy or any other vendor. However the cost of hosting a static website in S3 is dirt cheap.

Please note the above calculation was done for Mumbai region on 11th April 2017. As AWS keeps dropping their prices, I would not be surprised if all the above calculation goes haywire in a few months. However, this should give you an idea of how much you will have to shell out if you decide to host a static website on S3. Though the above calculation should be good enough for most of the simple websites hosting basic static content, you will have to do your own calculation for your specific requirements.

--

--

Dilip Kola
Tensult Blogs

Spirtual Seeker | Mentor | Learner | Ex-Amazon | Ex-AWS | IIT Kanpur