CDP:Direct Hosting Pattern
Direct Hosting Using Internet Storage
Problem to Be Solved
You are not able to keep up by increasing the number of machines when there is a sudden increase in the number of accesses in a short period of time. While you might consider handling this by increasing the number of servers by forecasting the increase in accesses, increasing the number of servers wastefully is a problem in terms of cost.
Explanation of the Cloud Solution/Pattern
In this pattern, Internet storage provided by the AWS Cloud is used as a web server, to not only host large static files such as images and video, but to host HTML as well. Because Internet storage was originally designed envisioning use as shared storage, it has no problems in terms of capacity. Even if the number of accesses for a particular service were to increase suddenly, Internet storage as a whole would be able to perform the processing without problems, enabling use as a web server without you having to take any special measures to handle the load.
- Set up the S3 bucket to publish the content. Set up the bucket policies to permit public access of the content of the bucket.
- Turn on the website hosting function of S3 and set up an index page and an error page, to host the website on S3 alone.
- Access to the static content is left to S3, enabling you to increase the the availability and durability of the web system with ease.
- It is not possible to run a server-side program on S3, so it is not possible to output different pages for, for example, each user that has logged in.
- This pattern can still be used even in a dynamic site, such as the Amazon Content Management System (CMS). For example, if you use MovableType, when you post a blog, the blog engine writes out a static HTML file, which you can host in S3.
- S3 also has a function for issuing signed URLs. You can use this to issue a signed URL for allowing access to limited users only. You can also set an expiration for the signed URL. See the Private Distribution Pattern.
- A system for performing access validation, known as a "bucket policy," is also provided in S3. You can use this to enable access to specific users only, or to limit access to HTTPS only.
- As of March 2012, over 900 billion objects (files) are saved in S3, and, at peak times, over 700,000 requests per second have been handled.