The AWS CLI and console UI access S3 via AWS API behind scenes.
For e.g the getobject API
This feature allows access via standard HTTP for blogs, static websites provided the identity trying to access it is authenticated and authorized, the get object API call is used to access those resources.
Using API calls is secure and flexible.
Using S3 for static website hosting makes it more useful. It allows access via browser using the HTTP/S protocol.
Doing it is simple: Set an index and error html document
If a specific page is mentioned then that page is accessed. If no specific page is mentioned, then index page is displayed.
When a static website is enabled, we have to point the index document at a specific object in the S3 bucket.
The error document is the same. Used when something goes wrong. Both files need to be html documents because static website delivers html pages
When the feature is enabled on a S3 bucket, a website hosting endpoint is created. It is a specific address that the bucket can be accessed from using HTTP
Exact name of endpoint is influenced by bucket name that is chosen and the region it is in.
Custom domain can be used via R53 if the name of the bucket name matches the domain.
Static web hosting is great for hosting blogs and also for two other scenarios:
i) Offloading
ii) Out of band pages
Offloading
If a website needs to display static html pages like images, those images could be moved into S3 bucket which has static website hosting enabled.
S3 is cheaper for storage and delivery of any media versus a compute service
Out of band pages
An example of this is maintenance page
For e.g if a maintenance page needs to be shown while the server is under maintenance then DNS could be changed and point customers at a backup static website hosted on S3 and it can provide this status message and/or maybe the details of biz support team
S3 Pricing
S3 has a simple pricing structure.
There is a per gigabyte per month charge for storing data in S3 and also for transfer out, there is a per gig month charge
There is no transfer fee for transferring data into S3
There is a charge for different ops on the per 1000 operation rate.
In the free tier plan, 5G of monthly storage is provided free of cost. 20k get and 20k put requests are free.
There is a charge for every 1000 operation on the Static website