o7planning

Introduction to Amazon S3

View more Tutorials:

1- What is Amazon S3?

If you have a website with readers from many parts of the world, you will definitely be interested in CDN service. It helps you to distribute content to readers faster as well as to improve your website's ranking. As a result, you will get more readers.
Although Amazon S3 is not a CDN service, it is an important part of Amazon Cloudfront, the world's leading Amazon CDN service. In this article I try my best to share my knowledge of Amazon S3 with you, including the costs you need to pay when using it.
Both Amazon S3 and Cloudfront are great. They were successful in persuading me as I had formerly used another good CDN service, Cloudflare. I believe this article will be even more helpful to you if you are using WordPress, so don't leave the post, I will be answering what is Amazon S3 and explain the concepts related to it.
OK, Amazon S3 is an acronym of Amazon Simple Storage Service. It helps you to store files in a folder structure and you can access these files in the web environment.
Amazon S3 provides API(s) for you to upload, download files and manage their permissions. Besides, you can also manage files through an Amazon S3 administrative website available.
It sounds like Amazon S3 is not different from Google One or DropBox. They are similar in terms of storage costs, around $1/50GB/Month (2021 Price List). But here are the differences:

Google One / DropBox

If you need a storage of movies, music files, pictures, albums, etc., use Google Drive or DropBox and don't be worried about the amount of data that the user downloads since it is almost unlimited. They function as your remote hard drive.

Amazon S3

The cost of transferring data from Amazon S3 to the Internet is very expensive. You have to pay about $1 to transfer 11.7GB of data (that is insane!). Amazon S3 is often used to store static Websites, website-related static data, and it can function as a static website with several simple configuration steps.
Please do not close this article or rush to give up to the Amazon S3 solution when you see the price above. Let me tell you how to reduce the cost dozens of times at the end of the article.
It is important that some dynamic websites can be converted into static websites to deploy to Amazon S3, such as websites running on WordPress, and now you can say goodbye to the bulky VPS(s).
At last, Amazon S3 is part of the AWS ​​​​​​​(Amazon Web Services) ecosystem that easily integrates with other Amazon services.

2- S3 Bucket

S3 Bucket is a container for objects stored in Amazon S3, which can be considered corresponding to a website.

3- S3 Object

An Object in the S3 Bucket is usually known as a file, although it has a broader meaning, namely the data and metadata information of that file.
Metadata contains information of the file such as Content-Type, or the last time it was modified, etc. and some customized information that you provide.
You may probably think that all pages of a static website have the html extension, for example:
  • https://example.com/amazon-s3-tutorial.html
That was a mistake. In fact, on the S3 Bucket you can upload a file named "amazon-s3-tutorial" and set Content-Type="text/html" then you can access it with a nicer path:
  • https://example.com/amazon-s3-tutorial
You can also add information to the Metadata of the old page to permanently redirect it to the new page. This is one of the great features of Amazon S3.

4- S3 Regions

S3 Region: A geographic area that stores one S3 Bucket data, for example:
Region Name Code
US East (Ohio) us-east-2
US East (N. Virginia) us-east-1
US West (N. California) us-west-1
US West (Oregon) us-west-2
Africa (Cape Town) af-south-1
Asia Pacific (Hong Kong) ap-east-1
Asia Pacific (Mumbai) ap-south-1
Asia Pacific (Osaka-Local) ap-northeast-3
Asia Pacific (Seoul) ap-northeast-2
Asia Pacific (Singapore) ap-southeast-1
Asia Pacific (Sydney) ap-southeast-2
Asia Pacific (Tokyo) ap-northeast-1
Canada (Central) ca-central-1
China (Beijing) cn-north-1
China (Ningxia) cn-northwest-1
Europe (Frankfurt) eu-central-1
Europe (Ireland) eu-west-1
Europe (London) eu-west-2
Europe (Milan) eu-south-1
Europe (Paris) eu-west-3
Europe (Stockholm) eu-north-1
Middle East (Bahrain) me-south-1
South America (São Paulo) sa-east-1
Selecting a geographic area to place your S3 Bucket is quite important as it is related to the price of the service you need to pay to Amazon. I will bring it up soon, but basically putting your S3 Bucket in Europe or America will be at the lowest price.

5- S3 Keys

Each S3 Bucket object has a Key which is the path to the object. For example, the main.js object in the following illustration has the Key called:
  • static/js/main.js

6- What about the cost?

An important thing before using any service is to estimate the cost you need to pay. Now assuming that you are placing your S3 Bucket in the US or Europe where you get the cheapest service price as supposed to other regions with a bit higher charges.
Basically you can create one or more S3 Bucket(s) to store the data, the amount you need to pay is based on the total amount of data stored on all S3 Bucket(s)
You have to pay $0.023/1GB/Month. In other words, with $1 a month you can store 43GB of data on the S3 Bucket(s). If you use the S3 Bucket to store data of a common website, the cost is obviously negligible.
In addition, you also have to pay the cost when using the Rest API to synchronize data from your computer to the S3 Bucket. Specifically, if you make 1000 requests in order to upload 1000 files to the S3 Bucket, you have to pay about $0.005. It does not depend on the file size. Generally, the cost is not really that significant.
1000 Requests Price
PUT, COPY, POST, LIST $0.005
GET, SELECT $0.0004
The worst thing is that the cost of transferring data from the S3 Bucket (or Cloudfront) to the Internet is incredibly expensive. The first 1 GB you get is free of charge. Later, you pay about $0.085/1GB, which means you pay $1 in order to transfer 11.7GB of data.
A page will include HTML and other static data such as Image, Css, Javascript and so on with an average size of roughly 2MB, or sometimes 5MB if your website contains lots of images.
OK. Assuming that the size of each page is 2MB and each user views one page of yours, 11.7GB is only enough to serve 5990 people (And you have to pay $1 to Amazon).
If your website has 20,000 visitors every day, it will cost you $3.3, and you must pay $100 each month.
Let's make a comparison with renting one​​​​​​​ VPS:
  • By renting a VPS at the price of $5/Month, you get 25GB of storage and 1000GB of data transmission for free.
  • By renting a VPS at the price of $20/Month, you get 80GB of storage and 4TB of data transmission for free.
Indeed, using the Amazon Cloudfront service is pricey. You can click on the link below for the detailed price list.

7- How to cut usage costs?

As analyzed above, prices are the Amazon S3 / Cloudfront issue, and yes it's very expensive, I have heard that people nag about this a lot on forums. Amazon S3 is an important part of Amazon Cloudfront. As I said at the beginning of the article that I prefer Amazon Cloudfront service to Cloudflare. Please do not yell at me right now because my following article will show you how to reduce your data transmission costs by 50 times:

View more Tutorials: